Hi there,
Thanks for reaching out to the Google Ads API Forum.
I can see that you have encountered AUTHENTICATION_ERROR error. This could potentially be using the wrong developer token for your API request. 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, as seen in their respective links.
Once you are able to get the exact same developer token that was copied from MCC account’s API center, then you may use it in your CURL, and double check if empty space is not added. Then retry your request.
For REST interface requests, you can enable logging via the curl command by using the -i flag. This will cause the tool to include the HTTP response headers in the output. Kindly provide the complete logs via reply privately to author option.
However, a sample CURL request you may try below:
curl -f --request POST "https://googleads.googleapis.com/v12/customers/${CUSTOMER_ID}/googleAds:searchStream" \ --header "Content-Type: application/json" \ --header "developer-token: ${DEVELOPER_TOKEN}" \ --header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \ --header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \ --data '{ "query": " SELECT campaign.name, campaign_budget.amount_micros, campaign.status, campaign.optimization_score, campaign.advertising_channel_type, metrics.clicks, metrics.impressions, metrics.ctr, metrics.average_cpc, metrics.cost_micros, campaign.bidding_strategy_type FROM campaign WHERE segments.date DURING LAST_7_DAYS AND campaign.status != 'REMOVED' " }'
For your question “ Am I missing any step to access the Google Ads REST API? Is it possible that the REST API is not enabled somehow?”, you may check this page for the steps in REST API, and it is enabled for everyone as long as you have valid credentials for API calls.
Let us know how this goes on your end.
Regards,
|
||||||