I'm attempting to add a negative keyword to a specific ad group but am
receiving an authorization error ("The user does not have permission to
perform this action on the resource or call a method."). I'm able to add
keywords via Google Ads (ads.google.com). I'm also able to successfully
retrieve information for this same account via API's, so the read
functionality seems OK. I'm not sure if I need to regenerate credentials
now that I'm doing updates or if there's something else going on. Any
guidance or suggestions would be appreciated. Thanks.
Here's the code I'm using to perform the update.
ad_group_service = client.get_service('AdGroupService', version='v9')
ad_group_criterion_service =
client.get_service('AdGroupCriterionService', version='v9')
ad_group_criterion_operation =
client.get_type("AdGroupCriterionOperation")
ad_group_criterion = ad_group_criterion_operation.create
ad_group_criterion.ad_group = ad_group_service.ad_group_path(cid,
adgroupid)
ad_group_criterion.status =
client.enums.AdGroupCriterionStatusEnum.ENABLED
ad_group_criterion.keyword.text = keyword
ad_group_criterion.keyword.match_type =
(client.enums.KeywordMatchTypeEnum.EXACT)
ad_group_criterion.negative = True
response =
ad_group_criterion_service.mutate_ad_group_criteria(customer_id=cid,
operations=[ad_group_criterion_operation])
Here's a portion of the traceback showing the error.
GoogleAdsException: (<_InactiveRpcError of RPC that terminated with:
status = StatusCode.PERMISSION_DENIED
details = "The caller does not have permission"
debug_error_string =
"{"created":"@1642719263.522809000","description":"Error received from peer
ipv6:[2607:f8b0:4009:819::200a]:443","file":"src/core/lib/surface/call.cc","file_line":1075,"grpc_message":"The
caller does not have permission","grpc_status":7}"
>, <_InactiveRpcError of RPC that terminated with:
status = StatusCode.PERMISSION_DENIED
details = "The caller does not have permission"
debug_error_string =
"{"created":"@1642719263.522809000","description":"Error received from peer
ipv6:[2607:f8b0:4009:819::200a]:443","file":"src/core/lib/surface/call.cc","file_line":1075,"grpc_message":"The
caller does not have permission","grpc_status":7}"
>, errors {
error_code {
authorization_error: ACTION_NOT_PERMITTED
}
message: "The user does not have permission to perform this action on the
resource or call a method."
}
request_id: "hxiFkYimaxjxI38nUqPAxw"
, 'hxiFkYimaxjxI38nUqPAxw')
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/d71f97ee-0bb6-4f4e-9ba1-371b71524111n%40googlegroups.com.