Cannot Mutate Ad Group Criterion - Regs

2021-03-27 Thread Osoftz Tech
Hi Google Team,

I'm trying to *add user_interest criterion on ad group level*, but 
i *cannot mutate it*.
I keep getting following error - "*TypeError: Parameter to MergeFrom() must 
be instance of same class: expected 
google.ads.googleads.v5.services.AdGroupCriterionOperation got 
google.ads.googleads.v5.resources.AdGroupCriterion*"

 I have attached my code and request id.


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/070e8d2e-d3e4-49d0-b5a7-25899def034fn%40googlegroups.com.
[2021-03-27 11:45:45,761 - INFO] Request made: ClientCustomerId: 6948339166, Host: googleads.googleapis.com:443, Method: /google.ads.googleads.v5.services.AdGroupService/MutateAdGroups, RequestId: xBqDQ6a_BY37kYFyXYt6ow, IsFault: False, FaultMessage: None 


def adgroup_criterion_operation(customer_id, kwargs):
client = connect_ads_api()
adgroup_criterion_service = client.get_service("AdGroupCriterionService", version="v5")
criterion_operations_list = []
for interest_id in kwargs['affinity_list']:
adgroup_criterion_operation = client.get_type("AdGroupCriterionOperation", version="v5")
ad_group_operation = adgroup_criterion_operation.create
ad_group_operation.user_interest.user_interest_category = f'customer/{customer_id}/userInterests/{interest_id}'
criterion_operations_list.append(ad_group_operation)
try:
response = adgroup_criterion_service.mutate_ad_group_criteria(
customer_id, criterion_operations_list
)
except GoogleAdsException as ex:
print(
f'Request with ID "{ex.request_id}" failed with status '
f'"{ex.error.code().name}" and includes the following errors:'
)
for error in ex.failure.errors:
print(f'\tError with message "{error.message}".')
if error.location:
for field_path_element in error.location.field_path_elements:
print(f"\t\tOn field: {field_path_element.field_name}")
return None
return True




Documentation for using pre-registered tokens?

2021-03-27 Thread Donovan Langager
I have my own OAuth2 authentication system and save our keys in a 
table/object. I'm using the googleads-php-lib and would like to use my 
built OAuth class in the Ads API but I don't see any docs that reference 
such cases.

So far I can get tokens using my OAuth system but I would like to customize 
the GoogleAds Library to take in my registered token credentials instead of 
trying to fetch new ones on its own.

Thank you in advance!

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/bba8766e-6d12-4b90-b0ac-c198da69b61cn%40googlegroups.com.