update ad with REST throws fieldMask error

77 views
Skip to first unread message

Antonio Cortina

unread,
Jan 4, 2021, 7:40:40 AM1/4/21
to AdWords API and Google Ads API Forum
Hi,

Im using google ads api REST in an angular + node app.

I can modify final_urls from google ads but not expanded_text_ad properties. I tried several paths and I cant achieve it.

This is part of my code in node with the endpoint and payload object:

    const url = 'https://googleads.googleapis.com/v6/customers/' + dataIn.customerId + '/ads:mutate';

    let data = { 
      "operations": [
        { 
          "updateMask": "final_urls, expanded_text_ad.description",
          "update": {
            "resourceName": dataIn.advert['ad']['resourceName'],
            "final_urls": dataIn.advert['ad']['finalUrls'],
            "expanded_text_ad": {
              "description": dataIn.advert['ad']['expandedTextAd']['description']
            } 
          } 
        } 
      ] 
    };

This is the error:
{"code":400,"message":"Request contains an invalid argument.","status":"INVALID_ARGUMENT","details":[{"@type":"type.googleapis.com/google.ads.googleads.v6.errors.GoogleAdsFailure","errors":[{"errorCode":{"fieldMaskError":"FIELD_NOT_FOUND"},"message":"The field mask contained an invalid field: ' expanded_text_ad.description'.","location":{"fieldPathElements":[{"fieldName":"operations","index":0}]}}]}]}

I read this documentation about fieldMask but i dont know what im doing wrong:
https://github.com/protocolbuffers/protobuf/blob/master/php/src/Google/Protobuf/FieldMask.php

Can you help me?

PD: I know that client libraries generates fieldMasks path but i cant use them.

Google Ads API Forum Advisor Prod

unread,
Jan 4, 2021, 5:51:32 PM1/4/21
to antco...@gmail.com, adwor...@googlegroups.com

Hi Antonio,

Thank you for reaching out. Could you please confirm you are not making API calls using the third party Node.js client library? Please make sure the resource name you are using is following this pattern: customers/{customer_id}/ads/{ad_id}. Please also give it a try to use expanded_text_ad instead of expanded_text_ad.description for the updateMask field. 

Thanks and regards,
Xiaoming, Google Ads API Team

 

Google Logo
Xiaoming
Google Ads API Team
 


ref:_00D1U1174p._5004Q2AH7Zp:ref
Message has been deleted

Google Ads API Forum Advisor Prod

unread,
Jan 6, 2021, 12:58:49 AM1/6/21
to antco...@gmail.com, adwor...@googlegroups.com
Hi Antonio,

Thank you for sending these details.

You can try and review this documentation for more information on how you can implement REST and include the necessary fields/details for your request.

Let me know if this helps.

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


ref:_00D1U1174p._5004Q2AH7Zp:ref

Antonio Cortina

unread,
Jan 7, 2021, 8:27:44 AM1/7/21
to AdWords API and Google Ads API Forum
Hi,

Thanks for your response, but i think that i cant do so much with this info:

"GoogleAdsGoogleadsV6Services__AdOperation": { "id": "GoogleAdsGoogleadsV6Services__AdOperation", "properties": { "update": { "$ref": "GoogleAdsGoogleadsV6Resources__Ad", "description": "Update operation: The ad is expected to have a valid resource name in this format: `customers/{customer_id}/ads/{ad_id}`" }, "updateMask": { "format": "google-fieldmask", "description": "FieldMask that determines which resource fields are modified in an update.", "type": "string" } }, "type": "object", "description": "A single update operation on an ad." },

I read this google groups thread https://www.mail-archive.com/adwor...@googlegroups.com/msg83318.html where in fieldMask uses () to name all fields of a compound object. If I do this i dont receive an error response but the fields doesnt update:


    const url = 'https://googleads.googleapis.com/v6/customers/' + dataIn.customerId + '/ads:mutate';

    let data = {
      "operations": [
        {
          "updateMask": "finalUrls, expandedTextAd()",
          "update": {
            "resourceName": dataIn.advert['ad']['resourceName'],
            "finalUrls": dataIn.advert['ad']['finalUrls'],
            "expandedTextAd": {
              "description": dataIn.advert['ad']['expandedTextAd']['description'],
              "description2": dataIn.advert['ad']['expandedTextAd']['description2'],
              "headlinePart1": dataIn.advert['ad']['expandedTextAd']['headlinePart1'],
              "headlinePart2": dataIn.advert['ad']['expandedTextAd']['headlinePart2'],
              "headlinePart3": dataIn.advert['ad']['expandedTextAd']['headlinePart3']
            }
          }
        }
      ]
    };

Do you have any idea?

Thanks

Google Ads API Forum Advisor Prod

unread,
Jan 7, 2021, 5:23:00 PM1/7/21
to antco...@gmail.com, adwor...@googlegroups.com

Hi Antonio,

Thank you for reaching out. Could you confirm that the ad you were updating was the expandedTextAd type? If so, could you please share the complete request and response logs along with the client customer id and the ad id via the Reply privately to author option for us to further investigate?

Thanks and regards,
Xiaoming, Google Ads API Team
 

Google Logo
Xiaoming
Google Ads API Team
 


ref:_00D1U1174p._5004Q2AH7Zp:ref

Antonio Cortina

unread,
Jan 8, 2021, 7:52:27 AM1/8/21
to AdWords API and Google Ads API Forum

Hi,

Thanks for your response.

I cant reply privately to author, system says that I have not permission to reply author on this group


Google Ads API Forum Advisor Prod

unread,
Jan 8, 2021, 4:02:32 PM1/8/21
to antco...@gmail.com, adwor...@googlegroups.com

Hi Antonio,

Thank you for reaching out. Please send the requested information to our email alias googleadsa...@google.com.



Thanks and regards,
Xiaoming, Google Ads API Team

 

Reply all
Reply to author
Forward
0 new messages