How do I get a budget order for multiple AD accounts

110 views
Skip to first unread message

宋肖肖

unread,
Nov 26, 2017, 11:17:23 PM11/26/17
to AdWords API Forum

I can now get a budget order for an AD account, and the value I get is a two-dimensional array, 
so can I get a budget order for multiple AD accounts at once?Please give me the instruction. 
Here is my code

 // Generate a refreshable OAuth2 credential for authentication.
$oAuth2Credential = (new OAuth2TokenBuilder())
->fromFile()
->build();

$session = (new AdWordsSessionBuilder())
->fromFile()
// ->withClientCustomerId('728-018-0886')
->withClientCustomerId($data['customer_id'])
->withOAuth2Credential($oAuth2Credential)
->build();

$adWordsServices = new AdWordsServices();

$BudgetOrderService = $adWordsServices->get(
$session, BudgetOrderService::class);

// Create selector.
$selector = new Selector();

$selector->setFields([
'BillingAccountId','Id', 'BillingAccountName',
'PoNumber', 'BudgetOrderName', 'PrimaryBillingId', 'SecondaryBillingId',
'SpendingLimit', 'TotalAdjustments', 'StartDateTime', 'EndDateTime'
]);

// $selector->setOrdering([new OrderBy('CustomerId', SortOrder::ASCENDING)]);
$selector->setPaging(new Paging(0, self::PAGE_LIMIT));

$page= $BudgetOrderService->get($selector);

Vincent Racaza (AdWords API Team)

unread,
Nov 27, 2017, 4:03:44 AM11/27/17
to AdWords API Forum
Hi,

Currently, for the BudgetOrderService.get(), you can only get the budget orders per client account. However, from your MCC account, you can iterate the client accounts under it and get the budget orders per client account. This is a workaround on which you can implement. You can check the parallel report download example so you'll have an idea on how to iterate through the client accounts using the MCC Id as your clientCustomerId, and the ManagedCustomerService.get() to iterate the client accounts. You can then use the BudgetOrderService.get() inside the iteration of each account.

You can also check this guide for more information regarding budget orders.

Thanks,
Vincent
AdWords API Team

宋肖肖

unread,
Nov 27, 2017, 6:00:37 AM11/27/17
to AdWords API Forum

Thank you very much for your reply. I see.At present we are recycling data, but slower.

Thank you.That's all we can do

宋肖肖

unread,
Nov 27, 2017, 6:02:21 AM11/27/17
to AdWords API Forum

In addition to traversing it, there are other ways to make it faster, such as the asynchronous notification of the change of budgetorder

在 2017年11月27日星期一 UTC+8下午5:03:44,Vincent Racaza (AdWords API Team)写道:
Reply all
Reply to author
Forward
0 new messages