Integer or Float with Customizer

62 views
Skip to first unread message

cos...@gmail.com

unread,
Nov 29, 2018, 11:22:31 AM11/29/18
to AdWords API and Google Ads API Forum
I'm trying to add a customizer via the API. I would like to add it as an integer or float. I do the following:

customizer_feed = {
'feedName': feed_name,
'feedAttributes': [
{'type': 'STRING', 'name': 'a'},
],
}
     feed_service_operation = {'operator': 'ADD', 'operand': customizer_feed}
response = ad_customizer_feed_service.mutate([feed_service_operation])

The code above works, however, If I replace STRING with INT64 or FLOAT I get the following error:

googleads.errors.GoogleAdsServerFault: [RequiredError.REQUIRED @ operations[0].operand.feedAttributes[1].type]


I thought that the valid field types are these ones - Why it doesn't work?

Dannison Yao (AdWords API Team)

unread,
Nov 29, 2018, 4:19:39 PM11/29/18
to AdWords API and Google Ads API Forum
Hi Costantin,

The RequiredError.REQUIRED only error occurs when there are missing required fields.

Can you provide the complete XML SOAP request and response logs so we can investigate this further? You may use the Reply privately to author option. If you have not enabled the logging, you can tell me what client library you are using so I can point you to the proper guide.

Regards,
Dannison
AdWords API Team

cos...@gmail.com

unread,
Dec 3, 2018, 8:16:21 AM12/3/18
to AdWords API and Google Ads API Forum
Di Dannison,

This is the full request:

 ad_customizer_feed_service = client.GetService("AdCustomizerFeedService", version='v201809')
 feed_name
= "feed_xyz"

 customizer_feed
= {
 
'feedName': feed_name,
 
'feedAttributes': [

     
{'type': 'STRING', 'name': 'some string name'},
     
{'type': 'INT64', 'name': 'Int Name'},
 
],
 
}
 
# Types: https://developers.google.com/adwords/api/docs/reference/v201809/FeedService.FeedAttribute

 feed_service_operation
= {'operator': 'ADD', 'operand': customizer_feed}
 response
= ad_customizer_feed_service.mutate([feed_service_operation])

The mutate fails and gives me this:

Error summary: {'faultMessage': '[RequiredError.REQUIRED @ operations[0].operand.feedAttributes[1].type]', 'requestId': '00057c1de8XXXXXX', 'serviceName': 'AdCustomizerFeedService', 'methodName': 'mutate', 'operations': '1', 'responseTime': '311'}

......

line 1394, in MakeSoapRequest

    e.detail, errors=error_list, message=e.message)

googleads.errors.GoogleAdsServerFault: [RequiredError.REQUIRED @ operations[0].operand.feedAttributes[1].type]



This identical request with 'STRING' as the type for the second element (Int Name) works without any issue. 

Please let me know if I can provide more info. 

p.s. I'm using the official python library with Python 3.6

Dannison Yao (AdWords API Team)

unread,
Dec 4, 2018, 1:10:25 AM12/4/18
to AdWords API and Google Ads API Forum
Hi Costantin,

Upon comparing your code to the sample code provided here, I am seeing unnecessary commas, could you try the code snippet below which I have removed the commas?

customizer_feed = {
 'feedName': feed_name,
 'feedAttributes': [
     {'type': 'STRING', 'name': 'some string name'},
     {'type': 'INT64', 'name': 'Int Name'}
 ]
}

If the error is still persisting after trying the above suggestion, please send the complete SOAP request and response log so we could investigate this further. To enable SOAP logs on Python you can follow this guide.

Regards,
Dannison
AdWords API Team

cos...@gmail.com

unread,
Dec 4, 2018, 5:40:23 AM12/4/18
to AdWords API and Google Ads API Forum
Hi Dannison,

It's not an issue with the comma. The same request with STRING works just fine. This is the soap log:

[2018-12-04 12:33:45,246 - googleads.soap - INFO] Request made: Service: "AdCustomizerFeedService" Method: "mutate" URL: "https://adwords.google.com/api/adwords/cm/v201809/AdCustomizerFeedService"

[2018-12-04 12:33:45,249 - googleads.soap - DEBUG] Outgoing request: {'SOAPAction': '""', 'Content-Type': 'text/xml; charset=utf-8', 'authorization': 'REDACTED'}

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">

  <soap-env:Header>

    <ns0:RequestHeader xmlns:ns0="https://adwords.google.com/api/adwords/cm/v201809">

      <ns0:clientCustomerId>19XXXX</ns0:clientCustomerId>

      <ns0:developerToken>REDACTED</ns0:developerToken>

      <ns0:userAgent>unknown (AwApi-Python, googleads/15.0.0, Python/3.6.3, zeep)</ns0:userAgent>

      <ns0:validateOnly>false</ns0:validateOnly>

      <ns0:partialFailure>false</ns0:partialFailure>

    </ns0:RequestHeader>

  </soap-env:Header>

  <soap-env:Body>

    <ns0:mutate xmlns:ns0="https://adwords.google.com/api/adwords/cm/v201809">

      <ns0:operations>

        <ns0:operator>ADD</ns0:operator>

        <ns0:operand>

          <ns0:feedName>XYZ_475D6Z</ns0:feedName>

          <ns0:feedAttributes>

            <ns0:name>price</ns0:name>

            <ns0:type>FLOAT</ns0:type>

          </ns0:feedAttributes>

        </ns0:operand>

      </ns0:operations>

    </ns0:mutate>

  </soap-env:Body>

</soap-env:Envelope>


[2018-12-04 12:33:45,603 - googleads.soap - DEBUG] Incoming response: 

b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">\n  <soap:Header>\n    <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201809">\n      <requestId>00057c2fccd4e220XXX</requestId>\n      <serviceName>AdCustomizerFeedService</serviceName>\n      <methodName>mutate</methodName>\n      <operations>1</operations>\n      <responseTime>137</responseTime>\n    </ResponseHeader>\n  </soap:Header>\n  <soap:Body>\n    <soap:Fault>\n      <faultcode>soap:Client</faultcode>\n      <faultstring>[RequiredError.REQUIRED @ operations[0].operand.feedAttributes[0].type]</faultstring>\n      <detail>\n        <ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201809">\n          <message>[RequiredError.REQUIRED @ operations[0].operand.feedAttributes[0].type]</message>\n          <ApplicationException.Type>ApiException</ApplicationException.Type>\n          <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="RequiredError">\n            <fieldPath>operations[0].operand.feedAttributes[0].type</fieldPath>\n            <fieldPathElements>\n              <field>operations</field>\n              <index>0</index>\n            </fieldPathElements>\n            <fieldPathElements>\n              <field>operand</field>\n            </fieldPathElements>\n            <fieldPathElements>\n              <field>feedAttributes</field>\n              <index>0</index>\n            </fieldPathElements>\n            <fieldPathElements>\n              <field>type</field>\n            </fieldPathElements>\n            <trigger/>\n            <errorString>RequiredError.REQUIRED</errorString>\n            <ApiError.Type>RequiredError</ApiError.Type>\n            <reason>REQUIRED</reason>\n          </errors>\n        </ApiExceptionFault>\n      </detail>\n    </soap:Fault>\n  </soap:Body>\n</soap:Envelope>\n'

[2018-12-04 12:33:45,605 - googleads.soap - WARNING] Error summary: {'faultMessage': '[RequiredError.REQUIRED @ operations[0].operand.feedAttributes[0].type]', 'requestId': '00057c2fccd4e2200aXXXXXX', 'serviceName': 'AdCustomizerFeedService', 'methodName': 'mutate', 'operations': '1', 'responseTime': '137'}





Please let me know if you find the issue!
Thank you!

Dannison Yao (AdWords API Team)

unread,
Dec 5, 2018, 2:19:36 AM12/5/18
to AdWords API and Google Ads API Forum
Hi Costantin,

Based on the latest logs that you have provided, you are specifying a wrong type for your feedAttributeName = price. Based on this documentation, 'Price' should have a type of STRING and not FLOAT.

Additionally, if you would need to create a feedAttribute with type INT64, the name should be Integer. You may refer to this sample code in Python on how you can create multiple feedAttributes.

If the issue still persists after trying all these suggestions, please provide the latest SOAP logs again so I could check this with the team further. You may provide the logs using the Reply privately to author option.

Regards,
Dannison
AdWords API Team

Costantin

unread,
Dec 5, 2018, 5:45:00 AM12/5/18
to AdWords API and Google Ads API Forum
Hi Dannison,

Sorry but I still don't get it.
The name field should be the column name, for type STRING, I can pass any random name and the column gets appropriately labeled with that name on Google Ads.
I'm pretty sure that the same is supposed to happen also with type FLOAT or other types. Why I would want to name a column with an integer name? The value, however, must be an integer if I set the type as INT64, that does make sense.

As a very minimal example you could try to make this request:

ad_customizer_feed_service = client.GetService("AdCustomizerFeedService", version='v201809')

customizer_feed
= {
                   
'feedName': 'feed name xyz',
                   
'feedAttributes': [{'type': 'STRING', 'name': 'this is the column name'}]}
feed_service_operation
= {'operator': 'ADD', 'operand': customizer_feed}
response
= ad_customizer_feed_service.mutate([feed_service_operation])


if response and 'value' in response: r = "VALID: {}".format(response)  
else: r = "NOT VALID: {}".format(response)


return r




This correctly returns:
VALID: { 'ListReturnValue.Type': 'AdCustomizerFeedReturnValue', 'value': [ { 'feedId': 85XXXXX, 'feedName': 'feed name xyz', 'feedStatus': 'ENABLED', 'feedAttributes': [ { 'id': 1, 'name': 'this is the column name', 'type': 'STRING' } ] } ] }

Now if I try to submit a column with type INT64:

 ad_customizer_feed_service = client.GetService("AdCustomizerFeedService", version='v201809')

 customizer_feed
= {
 
'feedName': 'feed name xyz 2',
 
'feedAttributes': [{'type': 'INT64', 'name': 'this is the column name 2'}]

}
 feed_service_operation
= {'operator': 'ADD', 'operand': customizer_feed}
 response
= ad_customizer_feed_service.mutate([feed_service_operation])



 
if response and 'value' in response: r = "VALID: {}".format(response)
 
else: r = "NOT VALID: {}".format(response)


 
print(r)
 
return r

This gives me the following error:
googleads.errors.GoogleAdsServerFault: [RequiredError.REQUIRED @ operations[0].operand.feedAttributes[0].type]


I've tried to use an integer as the name but that also didn't work. I'm pretty sure that the request above is supposed to work just like that. 
Could someone try to make the same request and see why is not working? I would really need this to work.

This is the full SOAP logs of the failed (the second) request:


[2018-12-05 12:39:41,601 - googleads.soap - INFO] Request made: Service: "AdCustomizerFeedService" Method: "mutate" URL: "https://adwords.google.com/api/adwords/cm/v201809/AdCustomizerFeedService"

 

[2018-12-05 12:39:41,601 - googleads.soap - DEBUG] Outgoing request: {'SOAPAction': '""', 'Content-Type': 'text/xml; charset=utf-8', 'authorization': 'REDACTED'}

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">

 
<soap-env:Header>

   
<ns0:RequestHeader xmlns:ns0="https://adwords.google.com/api/adwords/cm/v201809">


     
<ns0:clientCustomerId>197XXXXXX</ns0:clientCustomerId>

      <ns0:developerToken>REDACTED</
ns0:developerToken>

     
<ns0:userAgent>unknown (AwApi-Python, googleads/15.0.0, Python/3.6.3, zeep)</ns0:userAgent>

     
<ns0:validateOnly>false</ns0:validateOnly>

      <ns0:partialFailure>false</
ns0:partialFailure>

   
</ns0:RequestHeader>

  </
soap-env:Header>

 
<soap-env:Body>

   
<ns0:mutate xmlns:ns0="https://adwords.google.com/api/adwords/cm/v201809">

     
<ns0:operations>

       
<ns0:operator>ADD</ns0:operator>

        <ns0:operand>

          <ns0:feedName>feed name xyz 2</
ns0:feedName>

         
<ns0:feedAttributes>

           
<ns0:name>this is the column name 2</ns0:name>

            <ns0:type>INT64</
ns0:type>

         
</ns0:feedAttributes>

        </
ns0:operand>

     
</ns0:operations>

    </
ns0:mutate>

 
</soap-env:Body>

</
soap-env:Envelope>


 

[2018-12-05 12:39:42,717 - googleads.soap - DEBUG] Incoming response:  

b
'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">\n  <soap:Header>\n    <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201809">\n      <requestId>00057c43ffeXXXXXXX</requestId>\n      <serviceName>AdCustomizerFeedService</serviceName>\n      <methodName>mutate</methodName>\n      <operations>1</operations>\n      <responseTime>520</responseTime>\n    </ResponseHeader>\n  </soap:Header>\n  <soap:Body>\n    <soap:Fault>\n      <faultcode>soap:Client</faultcode>\n      <faultstring>[RequiredError.REQUIRED @ operations[0].operand.feedAttributes[0].type]</faultstring>\n      <detail>\n        <ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201809">\n          <message>[RequiredError.REQUIRED @ operations[0].operand.feedAttributes[0].type]</message>\n          <ApplicationException.Type>ApiException</ApplicationException.Type>\n          <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="RequiredError">\n            <fieldPath>operations[0].operand.feedAttributes[0].type</fieldPath>\n            <fieldPathElements>\n              <field>operations</field>\n              <index>0</index>\n            </fieldPathElements>\n            <fieldPathElements>\n              <field>operand</field>\n            </fieldPathElements>\n            <fieldPathElements>\n              <field>feedAttributes</field>\n              <index>0</index>\n            </fieldPathElements>\n            <fieldPathElements>\n              <field>type</field>\n            </fieldPathElements>\n            <trigger/>\n            <errorString>RequiredError.REQUIRED</errorString>\n            <ApiError.Type>RequiredError</ApiError.Type>\n            <reason>REQUIRED</reason>\n          </errors>\n        </ApiExceptionFault>\n      </detail>\n    </soap:Fault>\n  </soap:Body>\n</soap:Envelope>\n'

[2018-12-05 12:39:42,718 - googleads.soap - WARNING] Error summary: {'faultMessage': '[RequiredError.REQUIRED @ operations[0].operand.feedAttributes[0].type]', 'requestId': '00057c43ffe9XXXXXXX', 'serviceName': 'AdCustomizerFeedService', 'methodName': 'mutate', 'operations': '1', 'responseTime': '520'}



Dannison Yao (AdWords API Team)

unread,
Dec 6, 2018, 4:06:54 AM12/6/18
to AdWords API and Google Ads API Forum
Hi Costantin

My apologies for the confusion. Instead of using INT64 as the AdCustomizerFeedAttribute.Type, you should use the INTEGER as the value instead. Also, the FLOAT type is not supported for AdCustomizerFeedAttribute.Type as it is not included in this guide.

Let me know if it works after trying my suggestion.

Regards,
Dannison
AdWords API Team

Reply all
Reply to author
Forward
0 new messages