[SalesForce] Salesforce Marketing Cloud: How to retrieve Automation Activities via SOAP API

Every time I try to grab an Automation Activity via the SOAP API, I'm told "AutomationTasks" does not exist as a property of object_type of "Automation". The documentation says otherwise (https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/automation.htm).

Best Answer

Not all properties of objects are "Retrievable". The easiest way to check which properties can be retrieved is by issuing a Describe request against the API for the object. "AutomationTasks" is marked as not retrievable:

Request

Method = "POST" and SoapAction = "Describe"

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header>
      <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <wsse:UsernameToken wsu:Id="UsernameToken-31606811" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsse:Username>{{Username}}</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">{{Password}}</wsse:Password>
         </wsse:UsernameToken>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
      <DefinitionRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <DescribeRequests>
            <ObjectDefinitionRequest>
               <ObjectType>Automation</ObjectType>
            </ObjectDefinitionRequest>
         </DescribeRequests>
      </DefinitionRequestMsg>
   </soapenv:Body>
</soapenv:Envelope>

Response

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <soap:Header>
        <wsa:Action>DescribeResponse</wsa:Action>
        <wsa:MessageID>urn:uuid:bb1c8ace-f9d6-4983-a65c-b36c141d67fd</wsa:MessageID>
        <wsa:RelatesTo>urn:uuid:a44243bb-51cf-4686-ab56-c9bc8940dfd9</wsa:RelatesTo>
        <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
        <wsse:Security>
            <wsu:Timestamp wsu:Id="Timestamp-0bf2a344-7b36-4ed2-8c95-38f07eb0aaec">
                <wsu:Created>2017-06-09T01:05:17Z</wsu:Created>
                <wsu:Expires>2017-06-09T01:10:17Z</wsu:Expires>
            </wsu:Timestamp>
        </wsse:Security>
    </soap:Header>
    <soap:Body>
        <DefinitionResponseMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
            <ObjectDefinition>
                <ObjectType>Automation</ObjectType>
                <Properties>
                    <PartnerKey xsi:nil="true" />
                    <ObjectID xsi:nil="true" />
                    <Name>ObjectID</Name>
                    <DataType>String</DataType>
                    <IsUpdatable>true</IsUpdatable>
                    <IsRetrievable>true</IsRetrievable>
                    <IsRequired>true</IsRequired>
                </Properties>
...
                <Properties>
                    <PartnerKey xsi:nil="true" />
                    <ObjectID xsi:nil="true" />
                    <Name>AutomationTasks</Name>
                    <DataType>AutomationTask[]</DataType>
                    <IsUpdatable>true</IsUpdatable>
                    <IsRetrievable>false</IsRetrievable>
                </Properties>
...
                </Properties>
            </ObjectDefinition>
            <RequestID>74d36995-9e1c-4ed3-b502-34a91ad3dfbd</RequestID>
        </DefinitionResponseMsg>
    </soap:Body>
</soap:Envelope>
Related Topic