Hi there

I have three questions to get accounts information(name, id, parent id)

   1. 
   
   Is there any sample code to get all accounts detail(name, id, parent id) 
   information fast? It looks like If I have many accounts like 5,000, I need 
   to make requests 5000 times. So please let me know If I can get all 
   accounts within only one API call or a couple of times and If you leave 
   some sample code for it Like Adwords have some code about it, would be 
   really helpful.
   - 
   
https://developers.google.com/adwords/api/docs/samples/java/account-management#get-the-account-hierarchy-under-the-current-account
   2. 
   
   How can I get only enabled accounts? Let say I have 5,000 actual 
   accounts but enabled accounts are about 2,000. So I want just that enabled 
   accounts list (name, id, parent id).
   With AdWords API it's really easy to get it like below.
   

   - This is a sample with Adword

int offset = 0;int PAGE_SIZE = 5000;
SelectorBuilder selectorBuilder = new SelectorBuilder()
                    .fields(ManagedCustomerField.CustomerId, 
ManagedCustomerField.Name,  ManagedCustomerField.CanManageClients)
                    .equals(ManagedCustomerField.CanManageClients, 
String.valueOf(false)).offset(offset).limit(PAGE_SIZE);
ManagedCustomerPage page;

page = managedCustomerService.get(selectorBuilder.build());

            for (ManagedCustomer customer : page.getEntries()) {

                    log.debug("customer: {}", customer.getName());

            }



   1. When I loop to get accounts information, I can see quite many times 
   'CUSTOMER_NOT_ENABLED' error, Even though I just want to get simple 
   information like name, parent account id. Is there any other Service or 
   resource I can use to get that simple information(name, parent id)?


   - I'm using CustomerServiceClient to get account information.

Here is code I tried it to get all accounts.. please let me know a better 
approach

// Property settingResource resource = new 
ClassPathResource("/ads.properties");Properties props  = 
PropertiesLoaderUtils.loadProperties(resource);
props.setProperty("api.googleads.loginCustomerId", "xxxxxxxxx");
// Client create GoogleAdsClient googleAdsClient = 
GoogleAdsClient.newBuilder().fromProperties(props).build();GoogleAdsServiceClient
 googleAdsServiceClient = 
googleAdsClient.getLatestVersion().createGoogleAdsServiceClient();
// Sql setting String customer_client_sql = "SELECT customer.descriptive_name, 
customer.id, customer_client.resource_name, customer_client.client_customer, 
customer_client.level, customer_client.hidden  FROM customer_client";
// Search One time
 SearchGoogleAdsRequest request = SearchGoogleAdsRequest.newBuilder()
                .setCustomerId(testManagerId)
                .setPageSize(10000)
                .setQuery(customer_client_sql)
                .build();
// Loop Search to get Detail Customer Information for (GoogleAdsRow row : 
searchPagedResponse.getPage().getResponse().getResultsList()) {
     CustomerClient client = row.getCustomerClient();

     try {
                 CustomerServiceClient customerService = 
googleAdsClient.getLatestVersion().createCustomerServiceClient();
                Customer cc = 
customerService.getCustomer(client.getClientCustomer().getValue());            

                log.debug("customer info: {}", customer);
     } 
}


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/6be8d1b2-d3d3-40a1-b0f4-42d8291456fc%40googlegroups.com.

Reply via email to