2

I'm trying to use the ExactTarget SOAP-based Web Service to retrieve all the business units in my account. I can retrieve the account and the default/parent business unit, but I can't figure out how to get the retrieve request to retrieve all the business units in my account (parent + all children business units). I've tried to retrieve child business units individually, but that hasn't worked either.

Here's the code that returns only the default (parent) business unit:


    RetrieveRequest request = new RetrieveRequest();
        request.setObjectType("BusinessUnit");
        request.getProperties().add("AccountType");
        request.getProperties().add("ParentID");
        request.getProperties().add("BrandID");
        request.getProperties().add("PrivateLabelID");
        request.getProperties().add("ReportingParentID");
        request.getProperties().add("Name");
        request.getProperties().add("FromName");
        request.getProperties().add("BusinessName");
        request.getProperties().add("ParentName");
        request.getProperties().add("CustomerID");
        RetrieveRequestMsg requestMsg = new RetrieveRequestMsg();
        requestMsg.setRetrieveRequest(request);
    RetrieveResponseMsg responseMsg = stub.retrieve(requestMsg);

I get a valid response back but the results in the RetrieveResponseMsg only contains one business unit object. When I tried to use a SimpleFilterPart to select a child BusinessUnit, the results were null.

Any help or direction would be greatly appreciated.

0
1

You need to set QueryAllAccounts to true. I'm not a Java developer but I just tested with Python. I believe the following code should work for Java.

request.QueryAllAccounts = true;

You can find more information here: http://help.exacttarget.com/en/technical_library/web_service_guide/technical_articles/managing_enterprise_20_accounts_with_the_web_services_api/

1
  • Yes, this is the correct solution. Thanks for that! – Kelly J Andrews Jan 8 '14 at 0:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.