Hi,
I am trying to get all the budgets from all billing accounts used under an MCC account. I saw that I should use the BudgetOrderService to get BudgetOrders, but it returns me an empty page. I can get the billing accounts from the BudgetOrderService->getBillingAccounts, what am I doing wrong? I am using the most recent version of the API and had nothing before, I am also whitelisted.
Here is my code (PHP) :
public function getBudgets(AdWordsUser $user) {
// Get the service, which loads the required classes.
$budgetOrderService = $user->GetService('BudgetOrderService', ADWORDS_VERSION);
// Create selector.
$selector = new Selector();
$selector->fields = array('id', 'spendingLimit', 'endDateTime');
// Create paging controls.
$selector->paging = new Paging(0, AdWordsConstants::RECOMMENDED_PAGE_SIZE);
do {
// Make the get request.
$page = $budgetOrderService->get($selector);
print_r($page); // Here it says BudgetOrderPage Object ( [entries] => [totalNumEntries] => 0
// Show the information for all budgets
if (isset($page->entries)) {
foreach ($page->entries as $budgetOrder) {
echo $budgetOrder->id;
echo $budgetOrder->spendingLimit;
echo $budgetOrder->endDateTime;
}
}
// Advance the paging index.
$selector->paging->startIndex += AdWordsConstants::RECOMMENDED_PAGE_SIZE;
} while ($page->totalNumEntries > $selector->paging->startIndex);
}
}