Exemption request via BatchJob?

83 views
Skip to first unread message

Christian

unread,
Jun 20, 2016, 9:56:54 AM6/20/16
to AdWords API Forum
Hi guys,

we are creating campaigns with adgroups, ads and keywords via the BatchJob-Service with API-Version 2016/05  and I'm wondering how we can handle PolicyViolationErrors with the BatchJob-Service.

Reallife example:
We need to create a new campaign for an online pharmacy for the keyword "Aspirin". We get an "PolicyViolationError" (Pharma) from the API. I want to update the operation with an ExemptionRequest and resend it to the BatchJob-Service.
How can this be done? (Since the mutate-Service should'nt be used anymore).

The library-examples are using the mutate-service, which are deprecated...
How do I do it with the BatchJobService?

Thanks in advance,

Christian

Shwetha Vastrad (AdWords API Team)

unread,
Jun 20, 2016, 5:50:30 PM6/20/16
to AdWords API Forum
Hi Christian,

You can set the ExemptionRequest of the AdGroupAdOperation just like you would using a regular mutate operation. The results of the BatchJobOperation will be available in the downloadUrl of the BatchJobResponse. You need to check for errors which are exemptable and add an exemptionRequest with the corresponding PolicyViolationKey and retry the operation. If you know that your Ad will result in an exemptable policyViolationError ahead of time, you can add this exemptionRequest in the first BatchJobOperation itself. 

Regards,
Shwetha, AdWords API Team.

Christian

unread,
Jun 21, 2016, 2:45:25 AM6/21/16
to AdWords API Forum
Hi Swetha,

thanks for your answer. The problem is, we are doing it the way you describe it, but if we resend the AdGroup oder KeywordOperations with an ExemptionRequest the temporary IDs  are wrong. Here is a dump of the error:

object(MutateResult)#4184 (3) { ["result"]=> NULL ["errorList"]=> object(ErrorList)#4186 (1) { ["errors"]=> object(EntityNotFound)#4062 (6) { ["reason"]=> string(10) "INVALID_ID" ["fieldPath"]=> string(31) "operations[1].operand.adGroupId" ["trigger"]=> string(16) "TempAdGroupId: 3" ["errorString"]=> string(25) "EntityNotFound.INVALID_ID" ["ApiErrorType"]=> string(14) "EntityNotFound" ["_parameterMap":"ApiError":private]=> array(1) { ["ApiError.Type"]=> string(12) "ApiErrorType" } } } ["index"]=> int(1) }

How do we handle it? Because we create everything with temporary IDs first (campaign, adgroup, adgroupad, keywords), and if there is an exemptable error (e.g. pharma), we want to resend the operation with the exemption request.

Thanks,

Christian

Shwetha Vastrad (AdWords API Team)

unread,
Jun 21, 2016, 1:01:06 PM6/21/16
to AdWords API Forum
Hi Christian,

Since the BatchJob might contain other operations which could have succeeded, reusing the temporary IDs will result in an ENTITY_NOT_FOUND error. The operations which did succeed will have a valid identifier. You would need to parse the batch job results to find the policy violation error and keep track of the AdGroupId and/or CampaignId associated with it. The results are returned in the same order in which you pass them in the request. You could map the Ids of the entities to the index of the BatchJob results

For a regular mutate operation you would send the request with the validateOnly header set to true to check if the operations passed would result in any error, rectify the errors when possible and retry the operation.
Reply all
Reply to author
Forward
0 new messages