adGroupCriteria:mutate error response in json

36 views
Skip to first unread message

rpj

unread,
Aug 24, 2021, 12:22:48 PM8/24/21
to AdWords API and Google Ads API Forum
Ads API v8
java

I am not using a library, but rather coding in straight REST.  If an http post request is made to this uri : /customers/123456789/adGroupCriteria:mutate, and the request fails, what will the json look like? Note the request entails the several create operations and partial failures is not enabled.

To be more precise,  in the following code snippet, what will the json representation of mutateResponse look like in the case of failure:

JsonParser jsonParser = new JsonParser();
        try (CloseableHttpClient client = HttpClients.createDefault()) {
            try (CloseableHttpResponse response = client.execute(method)) {
                StatusLine statusLine = response.getStatusLine();
HttpEntity entity = response.getEntity();
JsonObject mutateResponse = null;
if (entity != null) {
BufferedReader reader = new BufferedReader(new InputStreamReader(entity.getContent()));
try {
JsonElement jsonElement = jsonParser.parse(reader);
mutateResponse = jsonElement.getAsJsonObject();
...

I have spent some time looking through doc, and I do realize that I can make a test request to find out, but it would be nice to have some up front knowledge of the json format, the fields and values therein. Thanks for your time.

Google Ads API Forum Advisor

unread,
Aug 27, 2021, 2:15:12 AM8/27/21
to ridge...@gmail.com, adwor...@googlegroups.com

Hello,

Thank you for reaching out to us.

Since you're using REST, you have check on this REST guide? It is also discuss there about JSON mappings. As for the mutateResponse, there is a separate guide for every REST method (sample: adGroupCriteria.mutate); however, there is no indicated format as to how the json would look like when the request fails. You can try this on your end instead to check how json response would look like. Fields and values should be included on those responses in relation to the specific REST method (as stated on each documentation).

Regards,

Google Logo
Mark Kevin Albios
Google Ads API Team
 


ref:_00D1U1174p._5004Q2MiOhw:ref

rpj

unread,
Aug 27, 2021, 5:04:48 PM8/27/21
to AdWords API and Google Ads API Forum
Thanks for your response. Yes, I've checked the sources you provide. I can see that in the adGroupCriteria.mutate doc the following would be the format of an error response when partialFailures is enabled:

{ "partialFailureError": { object (Status) }, "results": [ { object (MutateAdGroupCriterionResult) } ] }

However, I am not enabling partial failures, and the doc does not offer what that error response would look like. I'm mostly curious about where retryable errors will show up. For example, if the api request rate is too high, will that be reflected here: StatusLine statusLine = response.getStatusLine(), or, will it be embedded in a json  mutateResponse? The same question for an internal error or a concurrent modification database error, etc. Ultimately I may have to figure it out through trial and error of failed requests, but just thought it'd be nice to have an idea up front.

Google Ads API Forum Advisor

unread,
Sep 1, 2021, 1:01:34 PM9/1/21
to ridge...@gmail.com, adwor...@googlegroups.com
Hello,

My name is Matt and I work alongside Mark. At the moment, we do not have documentation for error responses. However, I will submit a feature request on your behalf to add this to the REST documentation.

Regards,
Matt
Google Ads API Team

Google Logo
Matt
Google Ads API Team
 


ref:_00D1U1174p._5004Q2MiOhw:ref
Reply all
Reply to author
Forward
0 new messages