I've built an XML SOAP API request which retrieves the names of all Automations within our BU. It looks like this:

  SET @endpoint = "https://[endpoint key -censored].soap.marketingcloudapis.com/Service.asmx"
  SET @payload = ""
  SET @payload = Concat(@payload, "<?xml version='1.0' encoding='utf-8'?>")
  SET @payload = Concat(@payload, "<soapenv:Envelope
  SET @payload = Concat(@payload, "<soapenv:Header>")
  SET @payload = Concat(@payload, "<wsse:Security soapenv:mustUnderstand='1'
  SET @payload = Concat(@payload, "<wsse:UsernameToken wsu:Id='UsernameToken-'
  SET @payload = Concat(@payload, "<wsse:Username>[Username -censored]</wsse:Username>")
  SET @payload = Concat(@payload, "<wsse:Password Type='http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText'>[Password -censored]</wsse:Password>")
  SET @payload = Concat(@payload, "</wsse:UsernameToken>")
  SET @payload = Concat(@payload, "</wsse:Security>")
  SET @payload = Concat(@payload, "</soapenv:Header>")
  SET @payload = Concat(@payload, "<soapenv:Body>")
  SET @payload = Concat(@payload, "<RetrieveRequestMsg xmlns='http://exacttarget.com/wsdl/partnerAPI'>")
  SET @payload = Concat(@payload, "<RetrieveRequest>")
  SET @payload = Concat(@payload, "<ObjectType>Program</ObjectType>")
  SET @payload = Concat(@payload, "<Properties>Name</Properties>")
  SET @payload = Concat(@payload, "</RetrieveRequest>")
  SET @payload = Concat(@payload, "</RetrieveRequestMsg>")
  SET @payload = Concat(@payload, "</soapenv:Body>")
  SET @payload = Concat(@payload, "</soapenv:Envelope>")

  HTTPPost2(@endpoint,'text/xml;charset=UTF-8',@payload, false, @output, @respheader,'SOAPAction','Retrieve')

In Postman my response is properly formatted in XML, when I output the response of the HttpPost2() on the CloudPage page I get this:

ACMJourney (copy) - 2019-05-22T050539.309
Brand ATest - 2017-05-17T095401.256
WelcomeJourney test - 2020-01-21T082909.000
ExactEvergageCA - 2020-01-21T043800.430
NoConditions - 2019-12-02T034244.241
Exact WhatsApp Demo - 2020-01-07T060749.923
Import sftpWebActivity Journey Test
Demo audience - 2017-05-18T062455.383
Test Journey Pascal - 2019-12-09T040317.706

I've formatted the response here for readability, as the real response has no line breaks and looks like one giant string and is pretty unreadable. It has no delimiter, so BuildRowSetFromString() doesn't work, BuildRowSetFromXML() doesn't work either. Anyone have a clue how I can process this data into a RowSet or how I can get an response in a XML or delimited format? Or did I forget something in the API call?


Rather than utilize the POST and build out the xml envelope, etc., why not utilize WSProxy inside SSJS and then be able to parse the JSON returned?

WSProxy has better efficiency than AMPscript/SSJS API functions - meaning it will be quicker AND it is returned in a format that is native to SSJS and easily parsed.


var prox = new Script.Util.WSProxy();

var cols = ["Name"];
var filter = {
  Property: "Status",
  SimpleOperator: "IN",
  Value: [-1,0,1,2,3,4,5,6,7,8]

var res = prox.retrieve("Program", cols, filter);

This would then return a JSON with all your Automation names inside it that you can then use the SSJS to parse.

If you need to convert it back into AMPscript, you can utilize the Variable functions in SSJS to pass them back and forth.

I wrote a quick article on my blog about creating an automation dashboard that may help as well.

  • Thanks a lot, this worked like a charm! – Rutger Feb 5 '20 at 8:25

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.