Hi Stiven,
The RESOURCE_EXHAUSTED
<https://developers.google.com/google-ads/api/docs/common-errors#resource_exhausted>
error
that you encountered means that a system frequency limit has been exceeded
due to too many requests in a short period of time. This being said, I
would suggest you to set up short delays between requests or combine more
operations in fewer requests. Currently, the Google Ads API doesn't have a
documentation for limits since it is still in beta. However, you could find
in this guide
<https://developers.google.com/google-ads/api/docs/common-errors> the
common errors available in the API which you might encounter. Also, this
guide <https://developers.google.com/google-ads/api/docs/troubleshooting> for
more information on troubleshooting.
With regards to retrieving the account id and the account name in one API I
call, I'm afraid it is not currently possible as the service for retrieving
the list of customers under one's account and retrieving of customer
information are two separate services.
Thanks and regards,
Luis
Google Ads API Team
On Sunday, January 13, 2019 at 4:47:25 AM UTC+8, Stiven Ariza wrote:
>
> I am loging with a Google Account and get MCC Account and SubAccounts,
> firts I get Customers Id and then I need to call another service to get
> Accounts name but I catch the next error:
>
> RESOURCE_EXHAUSTED: Quota exceeded for quota metric '
> googleads.googleapis.com/get_requests' and limit
> 'GetsPerMinutePerProject' of service 'googleads.googleapis.com' for
> consumer 'project_number:974234XXXXXXX'.
>
> Where can I see All Quotas and Limits of Google Ads API?
>
> is there way to obtain customer id and name in a one call to API?
>
> I share my code:
>
>
> public static List<String> GetAllCustomersId(GoogleAdsClient
> googleAdsClient) {
> List<String> customerLst = new ArrayList<String>();
> try (CustomerServiceClient customerServiceClient =
> googleAdsClient.getCustomerServiceClient()) {
> ListAccessibleCustomersRequest request =
> ListAccessibleCustomersRequest.newBuilder().build();
> ListAccessibleCustomersResponse response =
> customerServiceClient.listAccessibleCustomers(request);
> for (String custResource :
> customerServiceClient.listAccessibleCustomers(request).getResourceNamesList())
>
> {
> custResource = custResource.substring(custResource.lastIndexOf("/") + 1,
> custResource.length());
> /* Get tree customers*/
> String query = "SELECT customer.id, customer.descriptive_name,
> customer_client.resource_name, "
> + "customer_client.client_customer, customer_client.level, "
> + "customer_client.hidden FROM customer_client";
>
> try (GoogleAdsServiceClient client =
> googleAdsClient.getGoogleAdsServiceClient()) {
> SearchPagedResponse response1 =
> client.search(String.valueOf(custResource), query);
>
> for (GoogleAdsRow row : response1.iterateAll()) {
> String clientCus = row.getCustomerClient().getClientCustomer().getValue();
> clientCus = clientCus.substring(clientCus.lastIndexOf("/") + 1,
> clientCus.length());
> System.out.println("Data: " + clientCus);
> String accountNameStr = GetAccountName(googleAdsClient,
> Long.parseLong(clientCus));
> System.out.println("subaccount: " + accountNameStr);
> }
> }
>
> /**/
> }
> }
> return customerLst;
> }
>
> public static String GetAccountName(GoogleAdsClient googleAdsClient, long
> customerId) {
> String accountNameStr = "";
> try (CustomerServiceClient customerServiceClient =
> googleAdsClient.getCustomerServiceClient()) {
> String customerResourceName = ResourceNames.customer(customerId);
> Customer customer =
> customerServiceClient.getCustomer(customerResourceName);
> // Print account information.
> System.out.printf(
> "Customer with ID %d, descriptive name '%s', currency code '%s', timezone
> '%s', "
> + "tracking URL template '%s' and auto tagging enabled '%s' was
> retrieved.%n",
> customer.getId().getValue(), customer.getDescriptiveName().getValue(),
> customer.getCurrencyCode().getValue(), customer.getTimeZone().getValue(),
> customer.getTrackingUrlTemplate().getValue(),
> customer.getAutoTaggingEnabled().getValue());
> accountNameStr = customer.getDescriptiveName().getValue();
> }
> return accountNameStr;
> }
>
>
> Regards,
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/c2cec2b8-ea26-4d8e-b61a-fd5f8709051f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.