CustomerSerivce getCustomers no such method (migrating 201605 to 201607)

63 views
Skip to first unread message

raneen...@datorama.com

unread,
Jan 5, 2017, 11:02:29 AM1/5/17
to AdWords API Forum
Hi, 
i'm using the adowrds api ,
we are migrating the version to 201607 
one of the changes in this version is the way we  get the customers , the get method will not be in the new version and will be new method getCustomers()



in the previous version we did 
currently in 201605 we used this method => 
Customer mainCustomer = customerService.get();

and in case mainCustomer.getCanManageClients() equal to true 

we used this code to get all customers 

String mccCustomerId = mainCustomer.getCustomerId().toString();

ManagedCustomerServiceInterface customerServiceInterface = adWordsServices.get(session, ManagedCustomerServiceInterface.class);
// Create selector.
com.google.api.ads.adwords.axis.v201605.cm.Selector selector = new com.google.api.ads.adwords.axis.v201605.cm.Selector();
selector.setFields(new String[] { "Name", "CustomerId", "CurrencyCode", "DateTimeZone", "CanManageClients" });

// Get results.
ManagedCustomerPage page = customerServiceInterface.get(selector);




when i try to get the customers by the new version we got an error that no such method .

 example what we trying to do => Customer []mainCustomer2 = customerService.getCustomers();

the log :  Method threw 'java.lang.NoSuchMethodError' exception.

cause/detailMessage : => com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V


questions 

1)how to solve the problem ?
2)is there an migration guide for customers ? i didn't found in the library it only have the campaigns . 
3)how to get mainCustomer , and how to get all the customers that related to this mainCustomer .


Thanks in advance,
Raneen.

Vishal Vinayak (Adwords API Team)

unread,
Jan 5, 2017, 2:54:22 PM1/5/17
to AdWords API Forum
Hi Raneen,

I tried fetching the customer ID for an account using the following Java code (v201607) and I did not face any issues. 

CustomerServiceInterface customerService = adWordsServices.get(session, CustomerServiceInterface.class);
Customer[] customers = customerService.getCustomers();

To be able to debug further, could you please provide me with the SOAP XML request and response logs for the API call?

More details on how CustomerService works in various versions of the API are available in this guide. To fetch the entire account hierarchy in v201607, you can refer to this example in Java. Same example is available in other client libraries as well.

Regards,
Vishal, AdWords API Team
Message has been deleted

Peter Oliquino

unread,
Jan 3, 2018, 3:35:25 AM1/3/18
to AdWords API Forum
Hi Asad,

Regarding the issue discussed in this thread, could you confirm if you are intermittently encountering the said issue? If yes, I would recommend that you enable SOAP logging so that you can capture the complete request and response that our team can use to investigate further. Once the SOAP request and response is generated, you may send it to me privately using the Reply privately to author option.

If you haven't enabled logging yet, you may provide which client library you are using so I can then give you the appropriate guide to enable it.

Best regards,
Peter
AdWords API Team
Reply all
Reply to author
Forward
0 new messages