How to manipulate an object of Google Ads API's Enum class - python

430 views
Skip to first unread message

cam...@dintdigital.com

unread,
Nov 1, 2018, 2:05:28 PM11/1/18
to AdWords API and Google Ads API Forum
On the Google Ads API documentation it says that for the field campaign.advertising_channel_type, the return value is an ENUM. How can I manipulate this object of the ENUM class to get the value that I want ?

My problem is that when I print the response I can see in the traceback call the string value:

campaign { resource_name: "customers/<customer_id>/campaigns/<campaign_id>" id { value: 397083380 } name { value: "Lanzamiento SIKU" } advertising_channel_type: SEARCH
but when I extract the value like this: 
info['type'] = row.campaign.advertising_channel_type

and then print info, this is how it gets returned: 
"campanas": [ { "id": <campaign_id>, "name": "Lanzamiento SIKU", "type": 2 }]

There is NO information on Google's documentation on how to manipulate this class in order to get the string value, and there is also NO information on the mapping of what index corresponds to what string. 

Please help !

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Nov 1, 2018, 6:08:41 PM11/1/18
to AdWords API and Google Ads API Forum
Hello,

As you can see from here, 2 is the vale assigned for SEARCH campaigns. Could you please check that you are printing the right attribute in your code? If you are unable to verify, could you share the code snippet along with the programming language that you are using?

Thanks,
Sreelakshmi, AdWords API Team

cam...@dintdigital.com

unread,
Nov 26, 2018, 5:16:16 PM11/26/18
to AdWords API and Google Ads API Forum
I am extracting the attribute like this: row.campaign.advertising_channel_type  and I am using Python 2.7. the documentation you shared is missing information, it just says the value for enums 0,1,2,5. what about enums 3 and 4 ? also, i am not using the googleads api, I am using the google-ads api, would the enum mapping be the same ?

Teja Makani

unread,
Nov 28, 2018, 10:07:32 AM11/28/18
to AdWords API and Google Ads API Forum
Hello Camila,

Apologies for the inconvenience. I am Sreelakshmi's teammate responding on this thread. I was checking with the team on this issue. Looks like it is the issue related to the python client libraries as calls from other libraries resulted in advertising_channel_type as name as expected. I would recommend you to raise a new issue on the python client library. The client library specialists there will guide you better. Please let me know if you have any other concerns.

Regards,
Sai Teja, AdWords API Team.
Reply all
Reply to author
Forward
0 new messages