'Migrate getCustomers method from Ad Words to Google Ads
We are in process of migrating code from Ad Words to Google Ads. First step from this is to get all customers which are assigned to for logged in user. For this Ad Words has an API called "CustomerServiceInterface.getCustomers" method which returns all customers at once.
But in Google Ads, there doesn't seem to be similar method. All we could find was get-account-hierarchy
Looking at the code, it is getting all child accounts by recursion method.
This has a major performance bottleneck as it has to iterate over all accessible customers first and then recursively over all manager and their children.
Question for the experts here - is there any efficient way I can get all customers at once? At least can we get all managers accessible to logged in user?
We did find a relevant article - https://groups.google.com/g/adwords-api/c/UHWxe7ag7zI. But that seems to talk about API quota rather than performance.
Solution 1:[1]
It depends. Are you using a service account or authorization credentials for the user?
This matters because you can run a simple query against the regular service on the customer_client resource to get the logged in customer accounts.
SELECT
customer_client.client_customer,
customer_client.level,
customer_client.manager,
customer_client.descriptive_name,
customer_client.currency_code,
customer_client.time_zone,
customer_client.id
FROM customer_client
WHERE customer_client.level <= 1
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dave Davis |
