customerNegativeCriteria:mutate

93 views
Skip to first unread message

Ayodhya Joshi

unread,
Apr 4, 2022, 9:58:35 PM4/4/22
to Google Ads API and AdWords API Forum
Hi @all,

I am confused as to how to add type enum in my json payload. I am fllowing this documentation: https://developers.google.com/google-ads/api/rest/reference/rest/v9/customers.customerNegativeCriteria?hl=en#CustomerNegativeCriterion

Task add ip block in customer negative criterian. 
Code: 
data = {
"customer_id": "752345",
"operations": [
{
"create": {
"resourceName": "customers/752345/customerNegativeCriteria/1523254697",
"type": "IP_BLOCK",
}
}
],
}


head = {
"Authorization": "Bearer ya29.A0A",
"Content-Type": "application/json",
"developer-token": "tp5w",
"login-customer-id": "752345",
}

response = requests.post(
json=data,
headers=head,
)

print(response.json())

error: {'error': {'code': 400, 'message': 'Request contains an invalid argument.', 'status': 'INVALID_ARGUMENT', 'details': [{'@type': 'type.googleapis.com/google.ads.googleads.v9.errors.GoogleAdsFailure', 'errors': [{'errorCode': {'fieldError': 'REQUIRED'}, 'message': 'The required field was not present.', 'location': {'fieldPathElements': [{'fieldName': 'operations', 'index': 0}]}}], 'requestId': 'UKlHAbZ4m971g23Kt0TxOg'}]}

Google Ads API Forum Advisor

unread,
Apr 5, 2022, 2:05:02 AM4/5/22
to ayop...@gmail.com, adwor...@googlegroups.com
Hi Ayodhya,

Thank you for posting your concern.

I can see that you tried adding IP negative criterion for exclusions at the customer level. However, it appears that it is not supported at this level because it doesn't have an object as can be seen on this document.

With this, try instead the IpBlockInfo of the CampaignCriterionOperation for IP exclusions. Hope this will help.

Let me know if you have further questions. 

Regards,
Google Logo
Ernie John
Google Ads API Team
 


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