Query regarding Adwords API SQL Call.

191 views
Skip to first unread message

Bikram Bhuyan

unread,
Apr 3, 2022, 2:37:07 AM4/3/22
to Google Ads API and AdWords API Forum
Hello,

I am executing the below SQL query to fetch the list of Campaigns.

"SELECT campaign.id, campaign.name, campaign.status, campaign.serving_status, campaign.campaign_budget, campaign.start_date, campaign.end_date FROM campaign ORDER BY campaign.id"

Currently it is returning campaigns which are in "REMOVED" status as well. This was not returned by the older version of AdWords Api call.

Could you please suggest what is the syntax to exclude these campaign. Actually I need to fetch only "ENABLED" and "PAUSED" campaigns. So I need to include a where condition to the query with a clause like "Status IN (ENABLED, PAUSED)". But I am not able to figure out the actual syntax. Also I am not finding any suitable documentation on how to construct the query properly.

Please help.

Thanks,
Bikram.

Google Ads API Forum Advisor

unread,
Apr 4, 2022, 1:34:25 AM4/4/22
to bikram...@gmail.com, adwor...@googlegroups.com

Hi Bikram,

Thank you for reaching out to us.

I would recommend that you use the Google Ads Query Builder and Query Validator tools for constructing queries.

Upon checking, It is valid to filter only "ENABLED" and "PAUSED" campaigns.
Below is an example query to filter it from the above tools :

SELECT campaign.id, campaign.name, campaign.status, campaign.serving_status, campaign.campaign_budget, campaign.start_date, campaign.end_date FROM campaign where campaign.status IN ('ENABLED', 'PAUSED') ORDER BY campaign.id

That said, you may try out the above query and write back to us if you have additional clarifications.

Best regards,

Google Logo
Heidi
Google Ads API Team
 


ref:_00D1U1174p._5004Q2ZJGKQ:ref

Bikram Bhuyan

unread,
Apr 4, 2022, 2:02:51 AM4/4/22
to Google Ads API Forum Advisor, adwor...@googlegroups.com
Thanks a lot. Really appreciate the input. The Query Validator is very helpful.

Google Ads API Forum Advisor

unread,
Apr 4, 2022, 6:22:12 AM4/4/22
to bikram...@gmail.com, adwor...@googlegroups.com
Hi Bikram,

Thank you for the update.

I work with Heidi and we are glad to hear that. If you have further questions, please feel free to add those in this thread. Our team will be happy to assist and give support to you.

Regards,
Google Logo
Carmela
Google Ads API Team
 


ref:_00D1U1174p._5004Q2ZJGKQ:ref

Bikram Bhuyan

unread,
Apr 13, 2022, 2:15:24 AM4/13/22
to Google Ads API and AdWords API Forum
Hello,

I am trying to fetch the budget amount of the campaign using the Ad Query. Earlier I was using the "Amount" field of the campaign with AdWords api. In the new Google Ad api I am using the "campaign_budget.amount_micros" field based on the documentation (https://developers.google.com/google-ads/api/fields/v10/campaign_budget#campaign_budget.amount_micros). So below is my final query.

SELECT campaign.id, campaign.name, campaign.status, campaign.serving_status,  campaign_budget.amount_micros, campaign.start_date, campaign.end_date
FROM campaign WHERE campaign.status IN ('ENABLED', 'PAUSED') ORDER BY campaign.id

But I am having difficulty extracting the "amount_micros" field from the result. I am using Java Client and the parameter I can see if "googleAdsRow.getCampaign().getCampaignBudget()" but this is not returning the amount in micro value. Could you please suggest how can I extract the budget amount from the above query result?

Thanks,
Bikram.

Google Ads API Forum Advisor

unread,
Apr 13, 2022, 10:15:32 AM4/13/22
to bikram...@gmail.com, adwor...@googlegroups.com

Hello Bikram,

Thanks for reaching out to the Google Ads API Forum. Could you please provide us with the complete request and response logs with request ID and request header generated on your end, so that our team may take a closer look at the issue you’re experiencing.
If you haven’t enabled the logging yet, it can be enabled by navigating to the Client libraries > Your client library (ex. Java) > Logging documentation, which you can access from this link.

Please send the requested details via the Reply privately to the author option. If this option is not available, you may send the details directly to our googleadsapi-support@google.com alias by referring to this thread.

Best Regards,

Google Logo
Jakeia Sabrina
Google Ads API Team
 

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