1

I need to retrieve the info of the active journeys via API.

I've been trying to get it with the Retrieve method of WSProxy but I cannot find the correct object for it.

I've tried: Interaction, Interactions, InteractionBaseObject, InteractionDefinition, ... and always getting the same response:

"Status":"Error: XXX is not a valid ObjectType."

Does anybody know how to extract this information via SSJS?

Thanks in advance!

2
  • 3
    WSproxy is for SOAP objects. You interact with JB with REST. Sep 6, 2021 at 16:53
  • Thanks for your response! As far as I know, Interatcions are a SOAP object, right? I was looking for a workaround to get that info with WSProxy Sep 7, 2021 at 15:21

1 Answer 1

1

As mentioned by Adam Spriggs, JourneyBuilder is using the REST API and is not addressable via SOAP.

The object you are referring to are not related to the current JoruneyBuilder object in Marketing Cloud. As you can see in the SOAP Supported Operations For Objects And Methods neither InteractionBaseObject nor InteractionDefinition is listed at all.

Yes, there is a SOAP object for both of them but a simple api.describe('InteractionBaseObject') will return nothing.

The only official option to interact with JourneyBuilder is via the Journey Builder REST API.

The newly written documentation is a massive improvement and many examples are given on how to interact with this API.

You can execute any API call within SSJS inside SFMC by using Script.Util.HttpRequest()

Here is a simple function which should give you a good starting point to execute any REST or CRUD API call.

<script runat=server>
    Platform.Load("Core", "1");

    /**
     * Perform an HTTP request allowing the usage of API methods.
     *
     * @param {string} method           The method to use e.g: POST, GET, PUT, PATCH, and DELETE
     * @param {string} url              The url to send the request to
     * @param {string} [contentType]    The contentType to use e.g: application/json
     * @param {object} [payload]        A payload for the request body
     * @param {object} [header]         Header values as key value pair
     *
     * @returns {object} Result of the request
     */
    function httpRequest(method,url,contentType,payload,header) {
        var req = new Script.Util.HttpRequest(url);
        req.emptyContentHandling = 0;
        req.retries = 2;
        req.continueOnError = true;
        req.method = method;
        for( var k in header ) {
            req.setHeader(k, header[k]);
        }
        if(typeof contentType !== 'undefined' && contentType !== null) { req.contentType = contentType; }
        if(typeof payload !== 'undefined' && payload !== null) { req.postData = Platform.Function.Stringify(payload); }

        try {
            var res = req.send();

            return {
                status: Platform.Function.ParseJSON(String(res.statusCode)),
                content: Platform.Function.ParseJSON(String(res.content))
            };

        } catch(e) {
            return {
                status: '500',
                content: e
            };
        }
    }
</script>

You must log in to answer this question.

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