Approved (Limited) in API

67 views
Skip to first unread message

Rocket Agency

unread,
Apr 20, 2018, 5:59:55 AM4/20/18
to AdWords API Forum

Hi there

I am using this script https://gist.github.com/russorat/6dd1a0bab4a620822888 to identify any disapproved ads but it does not pick up Approved (Limited) ads and i would like to extend it.

I see here https://developers.google.com/adwords/api/docs/reference/v201802/AdGroupAdService.AdGroupAdPolicySummary that there is a field to pick this up, but i'm not familiar enough with the syntax of the API to know how to write the code to query this field. 

Can someone please explain to me how instead of the logic in the script linked at the top, i write code to query the above field to find all ads in active ad groups and campaigns where  combinedApprovalStatus in [Disapproved,Approved_Limited]

Thanks very much
Garry

Dhanya Sundararaju (AdWords API Team)

unread,
Apr 20, 2018, 11:46:07 AM4/20/18
to AdWords API Forum
Hi Garry,

From AdWords API perspective, you may use this sample code in Java, to get Disapproved Ads. You would need to give AdGroupId of an active AdGroup. To include Approved_Limited ads you would need to use the code snippet below :

List<String> status = new ArrayList<String>();
status.add(PolicyApprovalStatus.DISAPPROVED.toString());
status.add(PolicyApprovalStatus.APPROVED_LIMITED.toString());

// Create predicate 
Predicate predicate = new Predicate();
predicate.setField(AdGroupAdField.CombinedApprovalStatus.toString());
predicate.setOperator(PredicateOperator.IN);
predicate.setValues(status.toArray(new String[0]));

// Create selector.
SelectorBuilder builder = new SelectorBuilder();
Selector selector =
builder
.fields(AdGroupAdField.Id, AdGroupAdField.PolicySummary)
.orderAscBy(AdGroupAdField.Id)
.equals(AdGroupAdField.AdGroupId, adGroupId.toString())
.offset(offset)
.limit(PAGE_SIZE)
.build();
selector.setPredicates(new Predicate[] {predicate});


Please let me know if you have further questions. Also, you may want to post in the Scripts Community Forum to check with Scripts team if this indeed is possible via scripts.

Regards,
Dhanya, AdWords API Team
Reply all
Reply to author
Forward
0 new messages