0

I have struggling to get the SOAP API work to start the Automation Program. Below is the call I am using. It is returning OK status but the program doesn't start.

<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-wsswssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
 <soap:Header>
  <wsse:Security soap:mustUnderstand="1">
     <wsse:UsernameToken wsu:Id="SecurityToken-4c1eed3b-75ee-4d19-8712-731028aaad77">
        <wsse:Username>xxx</wsse:Username>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">xxx</wsse:Password>
     </wsse:UsernameToken>
  </wsse:Security>
</soap:Header>
<soap:Body>
  <PerformRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI ">
     <Action>start</Action>
       <Definitions>
 <Definition xmlns:p0="http://exacttarget.com/wsdl/partnerAPI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="p0:Automation">
     <ObjectID>5a77beda-bb60-xxxx-xxxx-f5c370e9f0f5</ObjectID>
  </Definition>
</Definitions>
       </PerformRequestMsg>
    </soap:Body>
</soap:Envelope>
4

This SOAP request is 100% correct.

I'm guessing that you are not using Perform as the SOAP Action verb in your header. You can include this in the header, e.g.:

curl -XPOST -H "Content-type: text/xml; charset=utf-8" -H "SOAPAction: Perform" -d @request.xml https://webservice.s?.exacttarget.com/Service.asmx

Alternatively, you can omit the Action from the header and include in your SOAP envelope. Refer to example below.

Important: In the SOAP request below, replace .s?. with your instance name. e.g. .s7.

<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
   <s:Header>
      <a:Action s:mustUnderstand="1">Perform</a:Action>
      <a:MessageID>urn:uuid:7e0cca04-57bd-4481-864c-6ea8039d2ea0</a:MessageID>
      <a:ReplyTo>
         <a:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
      </a:ReplyTo>
      <a:To s:mustUnderstand="1">https://webservice.s?.exacttarget.com/Service.asmx</a:To>
      <o:Security xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" s:mustUnderstand="1">
         <o:UsernameToken>
            <o:Username>username</o:Username>
            <o:Password>password</o:Password>
         </o:UsernameToken>
      </o:Security>
   </s:Header>
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <PerformRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
            <Action>start</Action>
            <Definitions>
                <Definition xsi:type="Automation">
                    <ObjectID>29fa9fff-774a-458d-a1f4-c50f99587664</ObjectID>
                </Definition>
            </Definitions>
        </PerformRequestMsg>
    </s:Body>
</s:Envelope>
4
  • Hi @Eliot, I am using Action as Perform in Header. Also I tried using your envelope (after making all the necessary edits) but it gives me "Bad Request". Also, in my original envelope, when I put any random ObjectID, it still gives me OK message. I think its just not hitting SFMC. Did my envelope work for you?
    – Maneesh
    Sep 9 '16 at 10:57
  • Sorry about the Bad Request, I've updated my code and you should be fine now. Regarding the 'OK' message, did the response envelope include <StatusMessage>Performed Activity</StatusMessage>? If not, the Activity would not have run. Check that you can start the automation (using Run Once) as the same user that you are authenticating with, could be a permissions issue. Sep 10 '16 at 4:33
  • Tried that but erroring again with the messae "Automation cannot be Performed. Automation has been marked as deleted." I am able to run from the UI. Except the User/Pwd/Instance, anything else I should be replacing in the call?
    – Maneesh
    Sep 12 '16 at 2:19
  • My guess is that you are using the Automation CustomerKey, not ObjectID. You will need to retrieve the ObjectID for the Automation first. I've documented the procedure here. Sep 12 '16 at 2:49
0
    Step: 1
To get Object ID

POST: https://mcmt-7nv1q6hv3gxktfpbqxjzrby.soap.marketingcloudapis.com/Service.asmx
Headers :- Content-Type : text/xml; charset=utf-8, SOAPAction : Retrieve

<soapenv:Envelope xmlns:soapenv="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">
   <soapenv:Header>
      <wsse:Security soapenv:mustUnderstand="1">
         <wsse:UsernameToken>
            <wsse:Username>UserName</wsse:Username>
            <wsse:Password>Password</wsse:Password>
         </wsse:UsernameToken>
      </wsse:Security>
   </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>Automation Name Created in SFMC Org</Value>
            </Filter>
         </RetrieveRequest>
      </RetrieveRequestMsg>
   </soapenv:Body>
</soapenv:Envelope>

You get an ObjectID in response body by saying OverallStatus OK


Step: 2
To start Automation
Note: In backend automation should be active

POST: https://mcmt-7nv1q6hv3gxktfpbqxjzrby.soap.marketingcloudapis.com/Service.asmx
Headers:- Content-Type: text/xml; charset=utf-8, SOAPAction: Perform

<soapenv:Envelope xmlns:soapenv="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">
   <soapenv:Header>
      <wsse:Security soapenv:mustUnderstand="1">
         <wsse:UsernameToken>
            <wsse:Username>Username</wsse:Username>
            <wsse:Password>Password</wsse:Password>
         </wsse:UsernameToken>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
      <PerformRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <Action>start</Action>
         <Definitions>
            <Definition xsi:type="Automation">
               <Client>
                  <ID> MID </ID>
               </Client>
               <ObjectID>Insert object id got from Step 1</ObjectID>
               <CustomerKey>Automation Key created in SFMC org</CustomerKey>
            </Definition>
         </Definitions>
      </PerformRequestMsg>
   </soapenv:Body>
</soapenv:Envelope>
1
  • Please do not post code in comments. Please review How to Answer and make an edit to your post to include everything that belongs in the answer, and use the formatting tools in the editor to format your code inclusions correctly.
    – David Reed
    Jan 12 at 15:33

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.