0

I am trying to fetch the ObjectID of an Automation created in Salesforce Marketing Cloud using SOAP API call. So that I can use that in starting the automation using API Call from a third party system.I am using the below code to fetch the same.

<?xml version="1.0" encoding="utf-8"?> <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> <fueloauth xmlns="http://exacttarget.com">{{accessToken}}</fueloauth> </soapenv:Header> <soapenv:Body> <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI"> <RetrieveRequest> <action>Retrieve</action> <ObjectType>Automation</ObjectType> <Properties>ProgramID</Properties> <Properties>Name</Properties> <Filter xsi:type="SimpleFilterPart"> <Property>Name</Property> <SimpleOperator>equals</SimpleOperator> <Value>Voucher_Redemption</Value> </Filter> </RetrieveRequest> </RetrieveRequestMsg> </soapenv:Body> </soapenv:Envelope>

But in Response, I am getting 500 error code and also the below error XML.

<?xml version="1.0" encoding="utf-8"?>

http://schemas.xmlsoap.org/ws/2004/08/addressing/fault urn:uuid:10e22599-6abe-4531-9d09-9340245d1221 http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous 2019-07-03T12:27:29Z 2019-07-03T12:32:29Z soap:Sender **

WSE012: The input was not a valid SOAP message because the following information is missing: action.

**

2
  • 1
    Add the following header pair into your call: Name: SoapAction | Value: Retrieve. So would look like this - SoapAction: Retrieve. Jul 3, 2019 at 13:44
  • Hi @Gortonington thank you for your help now it worked....I was passing the name-value pair in the wrong place....It needed to be sent in the Header section of the call Jul 3, 2019 at 14:09

1 Answer 1

2

Here is a sample of a SOAP request that will return the ObjectID of an Automation

Replace {accessToken} with your accessToken accordingly

Replace {NameOfAutomation} with the exact name of your automation

Also make sure you are passing the appropriate headers as well.

Content-Type: text/xml; charset=utf-8
SOAPAction: Retrieve
<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>
    <fueloauth xmlms="http://exacttarget.com">{accessToken}</fueloauth>
   </soapenv:Header>
   <soapenv:Body>
      <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <RetrieveRequest>
            <ObjectType>Automation</ObjectType>
            <Properties>ProgramID</Properties>
            <Properties>Name</Properties>
            <Filter xsi:type="SimpleFilterPart" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
                <Property>Name</Property>
                <SimpleOperator>equals</SimpleOperator>
                <Value>{NameOfAutomation}</Value>
            </Filter>
         </RetrieveRequest>
      </RetrieveRequestMsg>
   </soapenv:Body>
</soapenv:Envelope>

You should get the following response which will include the ObjectID as well

<?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>RetrieveResponse</wsa:Action>
        <wsa:MessageID>urn:uuid:3c4abac7-6d22-4784-99e9-45fbed480f69</wsa:MessageID>
        <wsa:RelatesTo>urn:uuid:6410695b-21e0-4433-8b48-101e37316fa6</wsa:RelatesTo>
        <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
        <wsse:Security>
            <wsu:Timestamp wsu:Id="Timestamp-bac127ef-8243-4831-94b8-99917b6eab96">
                <wsu:Created>2019-07-03T16:05:11Z</wsu:Created>
                <wsu:Expires>2019-07-03T16:10:11Z</wsu:Expires>
            </wsu:Timestamp>
        </wsse:Security>
    </soap:Header>
    <soap:Body>
        <RetrieveResponseMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
            <OverallStatus>OK</OverallStatus>
            <RequestID>cc68d3dd-e2f7-4eef-8c4e-8821f9031b76</RequestID>
            <Results xsi:type="Automation">
                <PartnerKey xsi:nil="true" />
                <ObjectID>13cb7422-0219-41e5-ab5a-8f21a410bfb0</ObjectID>
                <Name>NameOfAutomation</Name>
            </Results>
        </RetrieveResponseMsg>
    </soap:Body>
</soap:Envelope>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .