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/074638fb-fbbd-4d48-b3c9-0a0bcf9c4455%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.