PHP AdGroupService not returning my adGroups?

26 views
Skip to first unread message

bobrev...@gmail.com

unread,
Jan 13, 2016, 8:24:56 AM1/13/16
to AdWords API Forum
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


Anthony Madrigal

unread,
Jan 13, 2016, 10:23:51 AM1/13/16
to AdWords API Forum
Hi,

You could try running our PHP example on getting ad groups. If you are still not getting any results, please send me your SOAP request and response through reply privately to author.

If you have not enabled logging, please see these instructions.

Cheers,
Anthony
AdWords API Team
Reply all
Reply to author
Forward
0 new messages