Error request for Google Ads report API

186 views
Skip to first unread message

Xin Chen

unread,
Jul 26, 2022, 5:31:38 AM7/26/22
to Google Ads API and AdWords API Forum
I tried to query campaign report data through ads http api but got an error.
My request is

POST /v11/customers/{my-customer-id}/googleAds:searchStream HTTP/1.1 
Developer-token: {my-developer-token} 
Content-length: 282 
Content-type: application/json 
Authorization: Bearer {access-token}
{
  "query" : "SELECT campaign.name, campaign.status, segments.device,
                    metrics.impressions, metrics.clicks, metrics.ctr,
                    metrics.average_cpc, metrics.cost_micros
            FROM campaign
            WHERE segments.date DURING LAST_30_DAYS"
}

The full response is

[
  {
    "error": {
      "status": "UNAUTHENTICATED",
      "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
      "code": 401,
      "details": [
        {
          "errors": [
            {
              "errorCode": {
                "authenticationError": "AUTHENTICATION_ERROR"
              },
              "message": "Authentication of the request failed."
            }
          ],
          "@type": "type.googleapis.com/google.ads.googleads.v11.errors.GoogleAdsFailure",
          "requestId": "kFLvE-o4K92C4wJLnVqPAw"
        }
      ]
    }
  }
]


And received the same response when running the example in google-ads-java.
Is this because that my account only has test account access? 
Please tell me the mistake I've made in the request.
Thanks!

Google Ads API Forum Advisor

unread,
Jul 26, 2022, 6:42:00 AM7/26/22
to chx...@gmail.com, adwor...@googlegroups.com

Hi,

Thanks for reaching out to the Google Ads API Forum.

Upon checking logs, I can see that you’ve encountered AUTHENTICATION_ERROR error, however, could you please double check if you’re sending the correct developer token for your API request? If you’re indeed sending the exact same developer token that was copied from MCC account’s API center, and still encountering it, then I request you may provide us with the complete logs in the format of the request and response logs along with the request-id without redacting, as seen in their respective links.

For you to enable complete logs on your end for the client library, logging can be enabled by navigating to the Client libraries > Your client library (ex Java) > Logging documentation, which you can access from this link. Kindly provide the requested details using reply privately to author option.

Regards,

Google Logo
Yasar
Google Ads API Team
 


ref:_00D1U1174p._5004Q2d1Uvv:ref

Xin Chen

unread,
Jul 26, 2022, 9:06:53 AM7/26/22
to Google Ads API and AdWords API Forum
Dear Yasar,
Thanks! The developer token was wrong.

Best wishes!

Google Ads API Forum Advisor

unread,
Jul 26, 2022, 11:42:43 AM7/26/22
to chx...@gmail.com, adwor...@googlegroups.com
Hi Xin,

Thank you for reaching out.

For the developer token is not approved. Non-approved developer tokens can only be used with test accounts" error message when you tried to access the production accounts with the test developer access. It is intended to get the error DEVELOPER_TOKEN_NOT_APPROVED, since you would need to request for at least a basic access level for developer token if you would be making calls to your production Google Ads accounts, by filling up and submitting this application form.

Let me know if you have any question.

Thanks,

Google Logo
Nirmitabahen Gaurav
Google Ads API Team
 


 

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