Not receiving CANNOT_TARGET_AND_EXCLUDE with Google Ads API

107 views
Skip to first unread message

Ashish Jani

unread,
Sep 28, 2021, 8:44:29 AM9/28/21
to AdWords API and Google Ads API Forum
Hello Team, 

We are migrating from Adwords API to Ads API and we have some queries.

Follows the below steps to reproduce:
1. Create target with postal code, for example: 07305 and negative/exclude with postal code 07307.
2. Both created successfully using Google Ads API
3. Now, update target with 07307 (which was negative while creation), so with the Adwords API we received CANNOT_TARGET_AND_EXCLUDE but while migrating to Google Ads API we are receiving IMMUTABLE_FIELD.
4. As this IMMUTABLE_FIELD is very generic error code, we can not use it to retry/handle the given condition.

So is there any way we can get error code CANNOT_TARGET_AND_EXCLUDE ?

It is available in Google Ads API doc:

Google Ads API Forum Advisor

unread,
Sep 29, 2021, 4:16:05 AM9/29/21
to dev.qa....@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for raising your concern to my team.

In order for the CANNOT_TARGET_AND_EXCLUDE error to show, you may try to create another criterion with the same information as you've set to postal 07307. Then, this time set is as targeted / positive criterion since the previous one is negative/excluded.

Let me know how it goes after trying the provided suggestion.

Regards,
Google Logo
Ernie John Blanca Tacata
Google Ads API Team
 


ref:_00D1U1174p._5004Q2OUkW8:ref

Ashish Jani

unread,
Sep 29, 2021, 5:24:17 AM9/29/21
to AdWords API and Google Ads API Forum
Thank you for the response.
We have tried your provided suggestion but the error code is same IMMUTABLE_FIELD instead of expected  CANNOT_TARGET_AND_EXCLUDE.

Error details:
 errors {
  error_code {
    field_error: IMMUTABLE_FIELD
  }
  message: "The field attempted to be mutated is immutable."
  location {
    field_path_elements {
      field_name: "operations"
      index: 1
    }
    field_path_elements {
      field_name: "create"
    }
    field_path_elements {
      field_name: "negative"
    }
  }
}
Thanks.

Google Ads API Forum Advisor

unread,
Sep 29, 2021, 10:13:04 PM9/29/21
to ashis...@emxdigital.com, adwor...@googlegroups.com
Hi Ashish,

Thank you for providing updates.

To take a closer look at your API requests, could you provide the complete request and response logs with request ID generated for successful API request of negative/exclude with postal code 07307 and for unsuccessful API request of creating targeted/positive postal code 07307?

If you haven't enabled the logging of the API transactions for the specific client library that you are using, then please refer to the specific guide below:
Java - https://developers.google.com/google-ads/api/docs/client-libs/java/logging
.Net - https://developers.google.com/google-ads/api/docs/client-libs/dotnet/logging
PHP - https://developers.google.com/google-ads/api/docs/client-libs/php/logging
Python - https://developers.google.com/google-ads/api/docs/client-libs/python/logging
Ruby - https://developers.google.com/google-ads/api/docs/client-libs/ruby/logging
Perl - https://developers.google.com/google-ads/api/docs/client-libs/perl/logging

You can provide it via Reply privately to author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.
Reply all
Reply to author
Forward
0 new messages