Update Campaign Name through Google Ads API

91 views
Skip to first unread message

caroline oscarsson

unread,
Apr 11, 2024, 10:55:34 PMApr 11
to Google Ads API and AdWords API Forum

Hi, 

I am getting errors in my Json script between google sheets and google ads. The goal with the scenario is to update current campaign names with new names found in the google sheet. When running the script, I get 404 error and can't figure out where the error is embedded in the script. I am using an API tool service called Make.com, which is both storing my access token and sends the output to the endpoint. I wonder if you could help me with my script to find why I get errors?

The greenmarked text is dynamic variables, fyi

[ { "url": "https://googleads.googleapis.com/v16/customers/Customer-ID//campaigns:mutate", "body": "{\n \"operations\": [\n {\n \"updateMask\": Current_Campaign_Name,\n \"update\": {\n \"resource_name\": customers/Customer-ID/campaigns/Campaign-ID,\n \"name\": New_Campaign_Name\n }\n }\n ]\n}", "method": "PUT", "headers": [ { "key": "Content-Type", "value": "application/json" } ] } ]

Zweitze

unread,
Apr 15, 2024, 3:41:55 AMApr 15
to Google Ads API and AdWords API Forum
A quick answer, instead of:
\"updateMask\": Current_Campaign_Name,
try
\"updateMask\": [\"name\"]
I believe updateMask should be a list of field name(s) that you intend to update - you pass a value.


Further, the new campaign name should also be passed in double quotes.
I hope these suggestions work out.

Google Ads API Forum Advisor

unread,
Apr 15, 2024, 11:37:33 AMApr 15
to adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

After verifying the provided logs, I could see that you have encountered the 404 error when trying to update the campaign name. 
and you have provided the wrong updateMask in the request. When I tried to replicate your issue on my end, I was able to update the campaign name. I would suggest that you try the below sample request to update the campaign name and let us know how this goes on your end.
{
  "operations": [
    {
      "update": {
        "resourceName": "customers/xxxxxxxxxx/campaigns/xxxxxxxxxxx",
        "name": "Test campaign"
      },
      "updateMask": "name"
    }
  ],
  "partialFailure": true
} 
This message is in relation to case "ref:!00D1U01174p.!5004Q02tP3TJ:ref" (ADR-00230880)

Thanks,
 
Google Logo Google Ads API Team


Google Ads API Forum Advisor

unread,
Apr 15, 2024, 11:38:24 AMApr 15
to zwe...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

@Zweitze  - Thank you for your input. I notice that you've already raised this concern in another thread titled 'Update Campaign Name through Google Ads API'. We've already provided a response there regarding this issue. To streamline communication and avoid redundancy, please refer back to that thread for any updates or further discussions on this topic. ​ ​ ​ ​ ​
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02tP5vZ:ref" (ADR-00231125)


Thanks,
 
Google Logo Google Ads API Team


Zweitze

unread,
Apr 15, 2024, 12:41:13 PMApr 15
to Google Ads API and AdWords API Forum

@Zweitze  - Thank you for your input. I notice that you've already raised this concern in another thread titled 'Update Campaign Name through Google Ads API'. We've already provided a response there regarding this issue. To streamline communication and avoid redundancy, please refer back to that thread for any updates or further discussions on this topic. ​ ​ ​ ​ ​

Could you elaborate on that? I gave a response in exactly one thread, which is... this thread?
Unless, maybe my account was hacked, obviously a very serious situation. So please share the link of the other thread with the same title, which I also appear to have answered?


 

Google Ads API Forum Advisor

unread,
Apr 16, 2024, 1:53:04 AMApr 16
to zwe...@gmail.com, adwor...@googlegroups.com
Hi Zweitze,

Sorry for the confusion.

Yes, I confirm that in this thread only you have provided the response but for that user query, we've already provided a response on another thread with the subject “Update Campaign Name through Google Ads API”. So to avoid multiple threads on the same issue, please take a look at that thread and continue the discussion on the same for further updates on the issue.

Zweitze

unread,
Apr 16, 2024, 2:39:31 AMApr 16
to Google Ads API and AdWords API Forum
I see. I shouldn't have answered at 9:41 because you answered before on an imaginary thread.
And/or because you answered before at 15:38, eight hours later.

I make sure that that will never happen again.
Good luck with your endeavors.

caroline oscarsson

unread,
Jul 2, 2024, 12:55:47 PMJul 2
to Google Ads API and AdWords API Forum
Hi, 

Thank you so much for verifying the logs for us. We have encountered a new error running above script according to the structure with error code "Mutates are not allowed for the requested resource., at operations" (check API request below). Why do you think we get this error code? The campaign type is primarly video and we have double checked the configuration wich is working as expected. 


{
    "response": {
        "status": 200,
        "headers": {
            "request-id": "TQKDYzCxRc7flPJj9gYuRQ",
            "content-type": "application/json; charset=UTF-8",
            "vary": "X-Origin, Referer, Origin,Accept-Encoding",
            "date": "Tue, 02 Jul 2024 07:58:35 GMT",
            "server": "ESF",
            "cache-control": "private",
            "x-xss-protection": "0",
            "x-frame-options": "SAMEORIGIN",
            "x-content-type-options": "nosniff",
            "alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000",
            "accept-ranges": "none",
            "connection": "close",
            "transfer-encoding": "chunked"
        },
        "body": {
            "results": [
                {}
            ],
            "partialFailureError": {
                "code": 3,
                "message": "Mutates are not allowed for the requested resource., at operations[0]",
                "details": [
                    {
                        "@type": "type.googleapis.com/google.ads.googleads.v17.errors.GoogleAdsFailure",
                        "errors": [
                            {
                                "errorCode": {
                                    "mutateError": "MUTATE_NOT_ALLOWED"
                                },
                                "message": "Mutates are not allowed for the requested resource.",
                                "trigger": {
                                    "stringValue": "VIDEO"
                                },
                                "location": {
                                    "fieldPathElements": [
                                        {
                                            "fieldName": "operations",
                                            "index": 0
                                        }
                                    ]
                                }
                            }
                        ],
                        "requestId": "TQKDYzCxRc7flPJj9gYuRQ"
                    }
                ]
            }
        }
    },
    "request": {
        "url": "https://googleads.googleapis.com/v17/customers/5334494302/campaigns:mutate",
        "qs": {},
        "headers": {
            "user-agent": "Make/production",
            "content-type": "application/json",
            "authorization": "***",
            "developer-token": "***",
            "login-customer-id": "5334494302"
        },
        "method": "POST",
        "body": {
            "operations": [
                {
                    "update": {
                        "resourceName": "customers/5334494302/campaigns/20942964853",
                        "name": "TEST(Olle) | TUAI - Cuba Libre | Local"
Reply all
Reply to author
Forward
Message has been deleted
0 new messages