SelectorError.INVALID_PREDICATE_FIELD_NAME on 'Status' while filtering campaign using CampaignService.

409 views
Skip to first unread message

Bo Gao

unread,
May 6, 2016, 9:00:10 AM5/6/16
to AdWords API Forum
Hi there,

I'm developing application with Adwords API V201509. I'm trying to filter campaigns by IDs and Status through CampaignService.

According to https://developers.google.com/adwords/api/docs/reference/v201603/CampaignService.Campaign#status I should use 'Status' as the field name to create Predicate. However, I got [SelectorError.INVALID_PREDICATE_FIELD_NAME @ selector; trigger:'Status']. I tried 'status', 'CampaignStatus' and 'campaignStatus' but got no luck.

AdGroup and AdGroupAd can be filtered by status using the same way I did to campaign. However, for AdGroup it accepts 'AdGroupStatus' rather than 'Status' which is mentioned in https://developers.google.com/adwords/api/docs/reference/v201603/AdGroupAdService.AdGroupAd#status .

Any comments on how to filter campaign by status? And why 'AdGroupStatus' for AdGroup? Thanks!

Peter Oliquino

unread,
May 6, 2016, 2:07:21 PM5/6/16
to AdWords API Forum
Hello,

You could use Campaign.status field to filter the campaigns using the CampaignService. Please check out below Java code to create the selector to filter the campaign using status field.

SelectorBuilder builder = new SelectorBuilder();
    Selector selector = builder
        .fields(CampaignField.Id, CampaignField.Name,CampaignField.Status)
        .orderAscBy(CampaignField.Name)
        .in(CampaignField.Status, "ENABLED", "PAUSED", "REMOVED")
        .offset(offset)
        .limit(PAGE_SIZE)
        .build();

Please check out GetCampaignsGetAdGroups and GetTextAds Java example code from the client library. Other languages example code could be found here.

Thanks,
Peter
AdWords API Team
Reply all
Reply to author
Forward
0 new messages