verified
Retrieve all JourneysRetrieve all Journeys from the Journey Builder in Salesforce Marketing Cloud.
REST API
var endpoint = restInstanceUrl + "interaction/v1/interactions";
var request = new Script.Util.HttpRequest(endpoint);
request.emptyContentHandling = 0;
request.retries = 2;
request.continueOnError = true;
request.setHeader("Authorization", "Bearer " + accessToken);
request.method = "GET";
request.contentType = "application/json";
request.encoding = "UTF-8";
var results = request.send();
var result = Platform.Function.ParseJSON(String(results.content));
Write(Stringify(result));
<script runat="server">
Platform.Load("core", "1");
var restInstanceUrl = "https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com/",
accessToken = "YOUR_REST_API_TOKEN";
try {
var endpoint = restInstanceUrl + "interaction/v1/interactions";
var request = new Script.Util.HttpRequest(endpoint);
request.emptyContentHandling = 0;
request.retries = 2;
request.continueOnError = true;
request.setHeader("Authorization", "Bearer " + accessToken);
request.method = "GET";
request.contentType = "application/json";
request.encoding = "UTF-8";
var results = request.send();
var result = Platform.Function.ParseJSON(String(results.content));
Write(Stringify(result));
} catch(error) {
Write(Stringify(error));
}
</script>
{
"count": 1,
"page": 1,
"pageSize": 50,
"links": {},
"items": [
{
"id": "S0M3-GU1D-K3Y-G03SR1G4T-H3R3",
"key": "S0M3-GU1D-K3Y-G03SR1G4T-H3R3",
"name": "New Journey - May 14 2023 7.00 PM",
"lastPublishedDate": "0001-01-01T00:00:00",
"description": "",
"version": 1,
"workflowApiVersion": 1,
"createdDate": "2023-05-14T19:00:00.000",
"modifiedDate": "2023-05-14T19:00:00.000",
"goals": [],
"exits": [],
"notifiers": [],
"stats": {
"currentPopulation": 0,
"cumulativePopulation": 0,
"metGoal": 0,
"metExitCriteria": 0,
"goalPerformance": 0
},
"entryMode": "MultipleEntries",
"definitionType": "Transactional",
"channel": "email",
"defaults": {
"properties": {
"analyticsTracking": {
"enabled": true,
"analyticsType": "google",
"urlDomainsToTrack": []
}
}
},
"metaData": {},
"executionMode": "Production",
"categoryId": 123456,
"status": "Draft",
"definitionId": "S0M3-GU1D-K3Y-G03SR1G4T-H3R3",
"scheduledStatus": "Draft"
}
]
}
Reference
Ressources and references related to the current methods.
Official documentation