3

I am trying to pull information about various sends from the API in an automated fashion into a Ruby on Rails app.

I can successfully run the call and parse the results for the entire account (including all business units) using this hash as my soap body:

{
  'tns:RetrieveRequest' => {
    'ObjectType' => 'Send',
    'Properties' => ['Additional', 'Duplicates', 'ExistingUndeliverables', 'ExistingUnsubscribes', 'ForwardedEmails', 'HardBounces', 'InvalidAddresses', 'MissingAddresses', 'NumberDelivered', 'NumberErrored', 'NumberExcluded', 'NumberSent', 'NumberTargeted', 'OtherBounces', 'SendDate', 'SendLimit', 'SentDate', 'SoftBounces', 'UniqueClicks', 'UniqueOpens', 'Unsubscribes','EmailName', 'Additional', 'ID','PartnerKey', 'PreviewURL'],
    'QueryAllAccounts' => true,
    :attributes! =>
    {
      'Filter' => {"xsi:type" => "tns:SimpleFilterPart"}
    },
    'Filter' =>
    {
      'Property' => 'SendDate',
      'SimpleOperator' => 'between',
      'DateValue' => ['2014-02-05', '2014-02-13']
    }
  }
}

However, this doesn't give me a good way to tie any of the sends back to specific business units (which correspond to our own internal customers). I'm looking for a way to either pull back business unit information as part of this call, or to run this call for only one business unit at a time.

I've been trying things like this for my soap body but to no avail:

{
  'tns:RetrieveRequest' => {
    'ObjectType' => 'Send',
    'Properties' => ['Additional', 'Duplicates', 'ExistingUndeliverables', 'ExistingUnsubscribes', 'ForwardedEmails', 'HardBounces', 'InvalidAddresses', 'MissingAddresses', 'NumberDelivered', 'NumberErrored', 'NumberExcluded', 'NumberSent', 'NumberTargeted', 'OtherBounces', 'SendDate', 'SendLimit', 'SentDate', 'SoftBounces', 'UniqueClicks', 'UniqueOpens', 'Unsubscribes','EmailName', 'Additional', 'ID','PartnerKey', 'PreviewURL'],
    'QueryAllAccounts' => true,
    'PartnerProperties' => 
    {
      'Name' => 'ClientID',
      'Value' => '0123456'
    },
    :attributes! =>
    {
      'Filter' => {"xsi:type" => "tns:SimpleFilterPart"}
    },
    'Filter' =>
    {
      'Property' => 'SendDate',
      'SimpleOperator' => 'between',
      'DateValue' => ['2014-02-05', '2014-02-13']
    }
  }
}

Can you provide me with the appropriate formatting of a call that can meet my needs?

2

It is possible to have the request return the ID for the Business Unit that the Send is related to by including Client.ID in the Properties array being passed.

It is also possible to specify a specific business unit for the retrieve by specifying the RetrieveRequest > ClientIDs > ID property and setting QueryAllAccounts to True. Example SOAP would look like:

<RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
    <RetrieveRequest>
        <ClientIDs>
            <ID>100000</ID>
        </ClientIDs>
        <ObjectType>Send</ObjectType>
        <Properties>Client.ID</Properties>
        <Properties>ID</Properties>
        <Properties>SendDate</Properties>
        <QueryAllAccounts>true</QueryAllAccounts>
    </RetrieveRequest>
</RetrieveRequestMsg>
| improve this answer | |

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.