Error 400 for retrieving Customer stats

186 views
Skip to first unread message

Al Kruger

unread,
Jun 11, 2023, 2:03:07 AM6/11/23
to Google Ads API and AdWords API Forum
Hi,
I want to retrieve weekly stats from an ad account.

with this JSON load:
{ "query" : "SELECT
  customer.descriptive_name,
  metrics.clicks,
  metrics.impressions,
  metrics.average_cpc,
  metrics.cost_micros
FROM customer
WHERE segments.date DURING LAST_7_DAYS”}

but I only receive a 400 error:
  • code 400
  • message: Request contains an invalid argument.
  • status: INVALID_ARGUMENT

What am I missing?

Thanks!

Google Ads API Forum Advisor

unread,
Jun 15, 2023, 8:03:09 AM6/15/23
to alkr...@gmail.com, adwor...@googlegroups.com

Hi there,

Thanks for reaching out to the Google Ads API Forum.

Upon checking your JSON, I can see that you are getting an error with message “Invalid JSON payload received. Closing quote expected in string.\n\n^",

 

{ "query" : "SELECT

  customer.descriptive_name,

  metrics.clicks,

  metrics.impressions,

  metrics.average_cpc,

  metrics.cost_micros

FROM customer

WHERE segments.date DURING LAST_7_DAYS}


As above JSON is missing a closing quote in string after LAST_7_DAYS. You may use below JSON structure:

{ "query" : "SELECT

  customer.descriptive_name,

  metrics.clicks,

  metrics.impressions,

  metrics.average_cpc,

  metrics.cost_micros

FROM customer

WHERE segments.date DURING LAST_7_DAYS"}

I hope this helps. 

This message is in relation to case "ref:_00D1U1174p._5004Q2mBiDO:ref"

Thanks,
 
Google Logo Google Ads API Team

 

 



Reply all
Reply to author
Forward
0 new messages