Hi,

You need to make sure you are hitting the sandbox endpoint. In the old java 
library you do by saying user.useSandbox(true); and make sure you call get 
campaings first so you sandbox account gets properly initialized. 

The right order will be:

   -  call get campaigns with no client id set 
   -  call get account hierarchy also with no client id set
   -  make note of the five sub accounts created under your sandbox MCC 
   account
   -  set any of the five ids as client id for you following API calls, 
   using either the adwords.properties files or programatically by calling the 
   AdWordsUser(String email, String password, String clientCustomerId, String 
   userAgent, String developerToken) constructor
   -  call any other API services. I recommend you start calling add 
   campaign -> add adgroup -> ... to create your account structure.
   

As an *important* side note, sandbox has been deprecated and I want to 
encourage apply and use test accounts instead see 
https://developers.google.com/adwords/api/docs/test-accounts for more 
details.

As another side note, I'd also recommend you using the new java client lib. 
The old library is still been maintained but the new one is the one is 
getting new features. Check it out at  
http://code.google.com/p/google-api-ads-java/

Best,

- David Torres - AdWords API Team

On Monday, November 19, 2012 2:44:19 PM UTC-5, Hum Hawks wrote:
>
> Hi, Paul:
>    I used single java client library(not soap):
> ----------------------------------------------------------------
> public static void main(String[] args) {
>         try {
>             // Log SOAP XML request and response.
>             AdWordsServiceLogger.log();
>
>             // Get AdWordsUser from "~/adwords.properties".
>             AdWordsUser user = new AdWordsUser(username, passcode, "", "",
>                     username + "++" + currencyCode, true);// new
>                                                             // 
> AdWordsUser().generateClientAdWordsUser(null);
>
>             // Get the ServicedAccountService.
>             ManagedCustomerServiceInterface managedCustomerService = user
>                     
> .getService(AdWordsService.V201209.MANAGED_CUSTOMER_SERVICE);
>
>             // Create selector.
>             Selector selector = new Selector();
>             selector.setFields(new String[] { "Login", "CustomerId" });
>
>             // Get results.
>             ManagedCustomerPage page = 
> managedCustomerService.get(selector);
>
>             if (page.getEntries() != null) {
>                 // Create map from customerId to customer node.
>                 Map<Long, ManagedCustomerTreeNode> 
> customerIdToCustomerNode = new HashMap<Long, ManagedCustomerTreeNode>();
>
>                 // Create account tree nodes for each customer.
>                 for (ManagedCustomer customer : page.getEntries()) {
>                     ManagedCustomerTreeNode node = new 
> ManagedCustomerTreeNode();
>                     node.managedCustomer = customer;
>                     customerIdToCustomerNode
>                             .put(customer.getCustomerId(), node);
>                 }
>
>                 // For each link, connect nodes in tree.
>                 if (page.getLinks() != null) {
>                     for (ManagedCustomerLink link : page.getLinks()) {
>                         ManagedCustomerTreeNode managerNode = 
> customerIdToCustomerNode
>                                 .get(link.getManagerCustomerId());
>                         ManagedCustomerTreeNode childNode = 
> customerIdToCustomerNode
>                                 .get(link.getClientCustomerId());
>                         childNode.parentNode = managerNode;
>                         if (managerNode != null) {
>                             managerNode.childAccounts.add(childNode);
>                         }
>                     }
>                 }
>
>                 // Find the root account node in the tree.
>                 ManagedCustomerTreeNode rootNode = null;
>                 for (ManagedCustomer account : page.getEntries()) {
>                     if 
> (customerIdToCustomerNode.get(account.getCustomerId()).parentNode == null) {
>                         rootNode = customerIdToCustomerNode.get(account
>                                 .getCustomerId());
>                         break;
>                     }
>                 }
>
>                 // Display account tree.
>                 System.out.println("Login, CustomerId (Status)");
>                 System.out
>                         .println(rootNode.toTreeString(0, new 
> StringBuffer()));
>             } else {
>                 System.out.println("No serviced accounts were found.");
>             }
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
>     }
>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en



Reply via email to