Need Help To Get the All Ad Accounts

179 views
Skip to first unread message

Hashcrypt Devs

unread,
Jun 6, 2024, 10:32:23 AM6/6/24
to Google Ads API and AdWords API Forum
Hi,

We're integrating google ads REST API to fetch records and use that records for analytics. 

So, as per our authentication flow We need to fetch all ad accounts together available in particular google ad manager account with single API call without passing customer Id. I want this as REST API.

Please provide appropriate solution for this.

Thanks

Google Ads API Forum Advisor

unread,
Jun 6, 2024, 5:12:47 PM6/6/24
to hashcr...@gmail.com, adwor...@googlegroups.com

Hi,

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

Upon reviewing your concern, I understand that you would like to fetch customers in your ad manager account. You can retrieve the customers by using the customers.listAccessibleCustomers method, which returns resource names of customers directly accessible by the user authenticating the call. I would suggest referring to this document for more information.

Additionally, you can list accessible customers using the Google Ads API without specifying a customer ID in the request.

This message is in relation to case "ref:!00D1U01174p.!5004Q02tJEen:ref" (ADR-00238738)

Thanks,
 
Google Logo Google Ads API Team


Hashcrypt Devs

unread,
Jun 7, 2024, 1:51:33 AM6/7/24
to Google Ads API and AdWords API Forum
We've tried with your given solution.
We've able to access the list of customers with below url and got the response:

URL : https://googleads.googleapis.com/v17/customers:listAccessibleCustomers
Response: 
image_2024_06_07T05_44_38_276Z.png

Now, we also want additional information like account name, status etc. Please provide appropriate solution for this. As your given API doesn't accept the POST parameters.

Thanks.

Google Ads API Forum Advisor

unread,
Jun 7, 2024, 2:12:09 AM6/7/24
to hashcr...@gmail.com, adwor...@googlegroups.com
Hi,

You can use the customer_client report, it provides the link between the given customer and a client customer. CustomerClients only exist for manager customers and all direct and indirect client customers are included, as well as the manager itself. Please see the below sample query to retrieve the 'status' (CANCELED, CLOSED, ENABLED, SUSPENDED) and 'account name' of the manager and client customer:
SELECT customer.id, customer_client.id, customer_client.descriptive_name, customer.descriptive_name, customer.status, customer_client.status FROM customer_client
I have tried to replicate the above query from my end using my customer ID and I got a successful run on the query and the results are returned.

Also, I would suggest you use the Query Builder to build your query and Query Validator to validate your query. You can utilize GoogleAdsService.SearchStream or GoogleAdsService.Search to retrieve the objects.

Hope this helps! Let us know if you have any further queries.

Hashcrypt Devs

unread,
Jun 7, 2024, 2:33:47 AM6/7/24
to Google Ads API and AdWords API Forum
I've tried with this given query as below,

URL : https://googleads.googleapis.com/v17/customers:listAccessibleCustomers/googleAds:searchStream
Method : POST
QueryParam : SELECT customer.id, customer_client.id, customer_client.descriptive_name, customer.descriptive_name, customer.status, customer_client.status FROM customer_client
Response: Screenshot 2024-06-07 120110.png



I'm getting error like this. Can you please appropriate solution for this. I want the customer details in this " https://googleads.googleapis.com/v17/customers:listAccessibleCustomers/googleAds:searchStream" URL. Is it possible? If not can you provide appropriate endopoint for the same.

Thanks

Google Ads API Forum Advisor

unread,
Jun 7, 2024, 3:11:43 AM6/7/24
to hashcr...@gmail.com, adwor...@googlegroups.com
Hi,

I understand that you've encountered the error '404' when running the query. I could see that you're combining both endpoints https://googleads.googleapis.com/v17/customers:listAccessibleCustomers/googleAds:searchStream. Please note that customers.listAccessibleCustomers and customers.googleAds.searchStream are both individual endpoints. Each endpoint will have its own parameters. I would suggest you use customers.googleAds.searchStream which returns all rows that match the search stream query. Once you open this customers.googleAds.searchStream on the right side, you will see three options Info: Chat and API. Click on API. Pass the required parameters and in the request body, select the 'query' and pass the previously provided query and click on Execute to see the results.  

For more information on how to use the endpoints, you may check the APIs Explorer documentation. Let us know if you face any issues.

Hashcrypt Devs

unread,
Jun 7, 2024, 3:32:21 AM6/7/24
to Google Ads API and AdWords API Forum
Thank you for the response.

Okay I understood your solution. But Is it possible to get customer details with this "https://googleads.googleapis.com/v17/customers:listAccessibleCustomers " endpoint.

Thanks

Google Ads API Forum Advisor

unread,
Jun 7, 2024, 3:57:37 AM6/7/24
to hashcr...@gmail.com, adwor...@googlegroups.com
Hi,

The customers.listAccessibleCustomers endpoint only provides the resource names of customers directly accessible by the user authenticating the call. It's not possible to retrieve customer details such as account name and status.

Hashcrypt Devs

unread,
Jun 7, 2024, 4:10:44 AM6/7/24
to Google Ads API and AdWords API Forum
Okay. Thank you for the response.
Reply all
Reply to author
Forward
0 new messages