I'm new to using adWords and the API, I'm using code based on the PHP examples and some Test accounts.
I've been able to do most of the things I need to do except the API will not return my adGroups.
API response looks like: AdGroupPage Object ( [entries] => [totalNumEntries] => 0 [PageType] => AdGroupPage [_parameterMap:Page:private] => Array ( [Page.Type] => PageType )
I retrieve my campaigns and loop through them and try to get the adGroups from each one, something like this:
foreach ($campaigns->entries as $campaign) {
$adGroupService = $user->GetService('AdGroupService', ADWORDS_VERSION);
// Create selector.
$selector = new Selector();
$selector->fields = array('Id', 'Name');
$selector->ordering[] = new OrderBy('Name', 'ASCENDING');
// Create predicates.
$selector->predicates[] =
new Predicate('CampaignId', 'IN', array($campaign->id));
// Create paging controls.
$selector->paging = new Paging(0, AdWordsConstants::RECOMMENDED_PAGE_SIZE);
$result = $adGroupService->get($selector);
}
I've tried removing the campaignId feature (i'd expect this to return all adGroups from the account?) but that also returns nothing. Is there something I need to do to the account or groups before the api will return them?
Thanks