Retrieving Ads Account Details

99 views
Skip to first unread message

Nicolas

unread,
Oct 18, 2024, 4:46:50 AM10/18/24
to Google Ads API and AdWords API Forum
Hi, I have question regarding Google API.

So I was able to get a list of ad accounts linked to my email using this endpoint

https://googleads.googleapis.com/v18/customers:listAccessibleCustomers

Now I'm trying to get the details on each of the ad account return from the endpoint. May I know which endpoint should I use to get the account details? Thank you

Google Ads API Forum Advisor

unread,
Oct 18, 2024, 7:00:16 AM10/18/24
to yukiha...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

In order to retrieve customer account details for each ad account in the Google Ads API, you can execute the following query:
SELECT customer_client.id, customer_client.level, customer_client.currency_code, customer_client.client_customer, customer_client.manager, customer_client.status, customer_client.resource_name FROM customer_client
You can try making a request using the Search or SearchStream by passing the customer Id. Also, you can use Query Builder to create your query and Query Validator to validate your query. I hope this helps, let me know how this goes on your end.

If you are not looking for this, kindly provide us the uncropped UI screenshot of the Google Ads account details individually that you require to retrieve via the API.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02vGf9V:ref" (ADR-00272179)

Thanks,
 
Google Logo Google Ads API Team


Nicolas

unread,
Oct 19, 2024, 2:48:10 AM10/19/24
to Google Ads API and AdWords API Forum
Hi, 
Thank you for the reply!

I tried using both Search and SearchStream with this information

https://googleads.googleapis.com/v17/customers/1234567890/googleAds:search On headers: Authorization: Access Token from https://oauth2.googleapis.com/token
developer-token: developer-token And I got this response {
    "error": {
        "code": 401,
        "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.",
        "status": "UNAUTHENTICATED",
        "details": [
            {
                "@type": "type.googleapis.com/google.rpc.ErrorInfo",
                "reason": "CREDENTIALS_MISSING",
                "domain": "googleapis.com",
                "metadata": {
                    "method": "google.ads.googleads.v17.services.GoogleAdsService.Search",
                    "service": "googleads.googleapis.com"
                }
            }
        ]
    }
}

Am I missing something? Thank you!

Nicolas

unread,
Oct 19, 2024, 2:52:52 AM10/19/24
to Google Ads API and AdWords API Forum
Sorry about the previous post, it was an issue with the access token.

Below is the error when I tried with the new access token. Do I need to set something on the query request body? If yes is there any example on what I need to add? Thanks again!

{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT",
"details": [
{
"errors": [
{
"errorCode": {
"queryError": "UNEXPECTED_END_OF_QUERY"
},
"message": "Error in query: unexpected end of query."
}
],
"requestId": "nwkI27hw9v9cmO_ii0Purw"
}
]
}
}

Nicolas

unread,
Oct 19, 2024, 2:57:44 AM10/19/24
to Google Ads API and AdWords API Forum
Sorry for the spam. I think I have figured it out. It seems the query is for the query on GAQL and now the endpoint shows the result. Thank you so much for the help!

Google Ads API Forum Advisor

unread,
Oct 21, 2024, 1:23:22 AM10/21/24
to yukiha...@gmail.com, adwor...@googlegroups.com

Hi,

By reviewing your concern, I understand that you are encountering an “UNEXPECTED_END_OF_QUERY” error. In order to investigate your issue further, kindly provide us with the complete API logs (request and response logs with request-id and request header) generated at your end.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java, .Net, PHP, Python, Ruby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

Reply privately to the author option, or direct private reply to this email.

Reply all
Reply to author
Forward
0 new messages