How to iterate over Ad Schedule objects as returned by CampaignCriterionService

17 views
Skip to first unread message

nikolas....@ideas2life.com.cy

unread,
Aug 17, 2018, 5:21:45 AM8/17/18
to AdWords API and Google Ads API Forum
I have set up a couple of Ad Schedules on some campaigns and I am using the CampaignCriterionService to obtain them.  I pass the AD_SCHEDULE string to the Selector, however when I iterate over $page->getEntries() which is a CampaignCriterion[] and invoking the getCriterion() function it just returns the base type not an AdSchedule, which I need to get the star and end times.

Any help is much appreciated.

Bharani Cherukuri (AdWords API Team)

unread,
Aug 17, 2018, 2:53:17 PM8/17/18
to AdWords API and Google Ads API Forum
Hello Nikolas, 

I was able to pull the Ad schedules by selecting the CriteriaType as AD_SCHEDULE. Please find the attached SOAP request and response as a reference. Here is the sample selector query in Java as a reference:

SelectorBuilder builder = new SelectorBuilder(); 
Selector selector = builder 
.fields(CampaignCriterionField.CriteriaType) 
.in(CampaignCriterionField.CriteriaType, "AD_SCHEDULE") 
.offset(offset) 
.limit(PAGE_SIZE) 
.build(); 

CampaignCriterionPage page; 
page = campaigncriteria.get(selector); 

If you continue to have an issue with this, please share the SOAP request and response logs, so I can take a closer look. You can reply back via Reply privately to author option. 

Thanks,
Bharani, AdWords API Team
Criteria_Logs.rtf
Reply all
Reply to author
Forward
0 new messages