Java ads api: device enum to device constant?

31 views
Skip to first unread message

dhmitc...@gmail.com

unread,
Oct 21, 2021, 11:09:08 AM10/21/21
to AdWords API and Google Ads API Forum
As far as we can tell, there's no way to map from `enums.DeviceEnum` or `common.DeviceInfo` to the 30000..30004 constants which seem to be what's needed as the `criterionId` for `utils.ResourceNames#campaignCriterion`. Am I missing something? Is the `criterionId` something else? 

Don Mitchell
Cargurus

dhmitc...@gmail.com

unread,
Oct 21, 2021, 11:15:36 AM10/21/21
to AdWords API and Google Ads API Forum
the 30000..30004 constants are from https://developers.google.com/google-ads/api/reference/data/codes-formats?hl=en#expandable-13; so, the question is how to map from the enum or device info obj to these or to a campaign constraint resource name.

Google Ads API Forum Advisor

unread,
Oct 22, 2021, 4:01:41 AM10/22/21
to dhmitc...@gmail.com, adwor...@googlegroups.com

Hello Cargurus,

Thank you for reaching out to us.

Can you try this campaign_criterion view and utilize these available fields (criterion_id | device.type)?

Let us know if this is what you're looking for.

Regards,

Google Logo
Mark Kevin Albios
Google Ads API Team
 


ref:_00D1U1174p._5004Q2QE62P:ref

dhmitc...@gmail.com

unread,
Oct 22, 2021, 10:09:14 AM10/22/21
to AdWords API and Google Ads API Forum
 I know how to get the constant. I even know how to get the campaign constraint id via a query. However, when I have to send out 10K campaign bid modifier updates several times a day, I don't want my server to query and then mutate the hundreds of times needed to go through each account. So, then I have to hardcode your constants in my code but it seems to me a gross oversight that DeviceEnum doesn't provide them and ResourceNames.campaignConstraintId doesn't have a method which takes DeviceEnum in place of the stupid constant which seems unconnected to any meaningful programming construct.

Please update the java api to provide an accessor to get the constants and you take responsibility for associating the constants with the DeviceEnum.

Don Mitchell

Google Ads API Forum Advisor

unread,
Oct 24, 2021, 11:51:04 PM10/24/21
to dhmitc...@gmail.com, adwor...@googlegroups.com
Hi Don,

I understand the inconvenience of the additional requests you are performing. Since this involves the Java client library, I would recommend that you reach out as well to the Java library owners via this link, for further guidance if there are ways to access the enums directly at the code level.

That said, allow me as well to create a feature request, subject for review, for this to be available directly via the API's services / resources. For now, you may keep an eye on our blog for updates and / or announcements.

Best regards,

Google Logo
Peter Laurence Napa Oliquino
Google Ads API Team
 


ref:_00D1U1174p._5004Q2QE62P:ref
Reply all
Reply to author
Forward
0 new messages