mutate_ad_group_ads() got an unexpected keyword argument 'response_content_type'

171 views
Skip to first unread message

Jing CHEN

unread,
Jan 4, 2022, 8:00:44 AM1/4/22
to AdWords API and Google Ads API Forum
Sincere regards
Why does this error happen?
And what should the correct call be if I use this filed?
thanks for your help
best wishes!
Snipaste_2022-01-04_20-51-18.png

Google Ads API Forum Advisor

unread,
Jan 4, 2022, 11:55:44 AM1/4/22
to lakaen...@gmail.com, adwor...@googlegroups.com
Hi Jing,

According to our optional request headers guide, when using any optional fields on a request method, the request message must be constructed outside of the method and passed in as a single parameter. Only the fields  fields that contain the annotation [(google.api.field_behavior) = REQUIRED] can be added as keywords. In ad_group_ad_service.proto, response_content_type isn't a required field. You can try editing add_responsive_search_ad.py to add optional request headers like this:
request = client.get_type("MutateAdGroupAdsRequest")
request.customer_id = customer_id
request.operations = [ad_group_ad_operation]
request.response_content_type = "MUTABLE_RESOURCE"
# Send a request to the server to add a responsive search ad.
ad_group_ad_response = ad_group_ad_service.mutate_ad_group_ads(
request = request
)

instead of this:

    ad_group_ad_response = ad_group_ad_service.mutate_ad_group_ads(
        customer_id=customer_id, operations=[ad_group_ad_operation]
    )

​​​​​​​I tried it and it worked. Feel free to get back to us.

Regards,

Google Logo
Aryeh Baker
Google Ads API Team
 


ref:_00D1U1174p._5004Q2TnhVU:ref

Mhmoudahmdmohmmd homydt

unread,
Jan 4, 2022, 2:26:02 PM1/4/22
to lakaen...@gmail.com, AdWords API and Google Ads API Forum
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api...@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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/b982ceb5-cfbf-47b7-a497-1612a5804fd5n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages