Hi all, 


I cannot fetch all the managed customers, not sure what's wrong 


I've tried a whole day, maybe it's associate with the mcc account ?


Please help us identify the problem.


Thanks.





<dependency>
    <groupId>com.google.api-ads</groupId>
    <artifactId>ads-lib</artifactId>
    <version>RELEASE</version>
</dependency>
<dependency>
    <groupId>com.google.api-ads</groupId>
    <artifactId>adwords-axis</artifactId>
    <version>RELEASE</version>
</dependency>




private static final int PAGE_SIZE = 20;

public static void main(String[] args) throws Exception {
    // Generate a refreshable OAuth2 credential.
    Credential oAuth2Credential = new OfflineCredentials.Builder()
        .forApi(OfflineCredentials.Api.ADWORDS)
        .withClientSecrets("client-id", "client-secret")
        .withRefreshToken("refresh-token")
        .build()
        .generateCredential();

    // Construct an AdWordsSession.
    AdWordsSession session = new AdWordsSession.Builder()
        .withDeveloperToken("developer-token")
        .withOAuth2Credential(oAuth2Credential)
        .withClientCustomerId("client-customer-id")
        .build();

    AdWordsServicesInterface adWordsServices = AdWordsServices.getInstance();

    runExample(adWordsServices, session);
}

public static void runExample(AdWordsServicesInterface adWordsServices, 
AdWordsSession session)
    throws Exception {
    // Get the ServicedAccountService.
    ManagedCustomerServiceInterface managedCustomerService =
        adWordsServices.get(session, ManagedCustomerServiceInterface.class);

    // Create selector builder.
    int offset = 0;
    SelectorBuilder selectorBuilder =
        new SelectorBuilder()
            .fields(ManagedCustomerField.CustomerId, ManagedCustomerField.Name)
            .offset(offset)
            .limit(PAGE_SIZE);

    // Get results.
    ManagedCustomerPage page;

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

        if (page.getEntries() != null) {
            // Create account tree nodes for each customer.
            for (ManagedCustomer customer : page.getEntries()) {
                System.out.println(customer.getName() + "  " + 
customer.getCustomerId());
            }
        }
        offset += PAGE_SIZE;
        selectorBuilder.increaseOffsetBy(PAGE_SIZE);
    } while (offset < page.getTotalNumEntries());
}

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords 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 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/5f367122-cfe0-4497-ac64-2236c1101432%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • Cannot get all... 郭文豪
    • Re: Canno... 郭文豪
      • Re: C... 'Nadine Sundquist (AdWords API Team)' via AdWords API Forum
        • R... wise
          • ... 'Nadine Sundquist (AdWords API Team)' via AdWords API Forum

Reply via email to