Welcome to part 4 of the series of posts that will give tips and tricks on how to deal with SOAP issues. As a SOAP-based web service, AdWords API can be easy to make calls to. At the same time, it can sometimes be difficult to debug the SOAP faults. In our previous episode, we discussed possible causes for "operation does not exist" errors. Today we'll discuss SOAP errors on failed validations. You can find links to our earlier posts here: Part 1, Part 2, Part 3.
A more generic error is "One or more input elements failed validation. (Error code 122)". In this case, the detail field of the response will contain a sequence of ApiError elements itemizing the validation errors found. The following fields may be specified:
- index: indicates the index of the element in the input array that caused the violation
- code: indicates the type of violation
- field: the input element field name that contains the violation
- trigger: a string describing the violation that triggered the error
- isExemptable: a boolean indicating whether it is possible to get an exemption for this kind of violation or not. The default is false
- textIndex: where in the text the violation occurred
- textLength: the length of the string that caused the violation
- detail: why the violation occurred
A common error that falls under this category is an Ad Policy violation. You receive an "The text specified for this Creative violates Google policy. (Error code 21)" error if you try to add an Ad that does not comply with Google’s Ad policy. To avoid getting this error, make sure that you check your Ads for policy violation using checkAds() before adding Ads using addAd(). If an Ad violates a policy, then checkAds() will return a sequence of ApiError objects that describe the policy violation. You can examine the details field to check what caused the policy violation. Also, some policy violations may be exemptable, and the isExemptable will be set as true if a policy violation is exemptable. If set, you can request for a policy exemption while adding this Ad.
Next time, we will explore errors that arise while syncing accounts, or performing concurrent requests to AdWords API.
--Anash Oommen, AdWords API Team