Skip to main content

Using the create flow execution function in Sitecore CDP REST API

Abstract

Provides a JSON example to create a flow execution in Sitecore CDP REST API (Data model 2.1).

You can use the flow execution REST API to perform the create flow execution function to execute an interactive experiment or web experiment over any web-based or mobile application. A flow is the mechanism that runs an experiment or experience on the Sitecore CDP back end.

You can use the browserID attribute, email attribute, identifiers object, custom field, or the experiment ID to create the flow execution.

To create a flow execution in Sitecore CDP, use the following:

POST: https://apiEndpoint/v2/callFlows

The following is a request that uses the browserId attribute:

{
    "clientKey": "abBah8aelipaPeebae7roox2tiexoSee",
    "channel": "WEB",
    "language": "en",
    "currencyCode": "EUR",
    "pointOfSale": "retailsite.com",
    "browserId": "56860bff-94ba-4d84-aa37-2b5a83d5411b",
    "friendlyId": "home_page_banner"
}

Request that uses the email attribute:

{
    "clientKey": "abBah8aelipaPeebae7roox2tiexoSee",
    "channel": "WEB",
    "language": "en",
    "currencyCode": "EUR",
    "pointOfSale": "retailsite.com",
    "email": "joe.bloggs@domain.com",
    "friendlyId":"home_page_banner"
}

Request that uses the identifiers object:

{
   "clientKey":"abBah8aelipaPeebae7roox2tiexoSee",
   "channel":"WEB",
   "language":"en",
   "currencyCode":"EUR",
   "pointOfSale":"retailsite.com",
   "identifiers":{
      "id":"myId",
      "provider":"myProvider"
   },
   "friendlyId":"home_page_banner"
}

Request that uses a custom field:

{
   "clientKey":"abBah8aelipaPeebae7roox2tiexoSee",
   "channel":"WEB",
   "language":"en",
   "currencyCode":"EUR",
   "pointOfSale":"retailsite.com",
   "params":{
      "loggedInState":"loggedIn",
      "someKey":"someValue"
   },
   "friendlyId":"home_page_banner"
}

The following is an example of a flow execution response:

[
    {
    "trackingUrl": "https://{apiEndpoint}/v3/trackers/eyJjaGFubmVsIjoiV0VCIiwiZGVjaXNpb25Nb2RlbFJlZiI6IjAzOTBmZTNiLTVmNTItNGM4NC1iNTBjLWEzYzUyMGMzMzhjYiIsImRlY2lzaW9uTW9kZWxWYXJpYW50UmVmIjoiNjYwNWNhMDMtNWE1Ni00NGI2LWFmMTQtZjJlNTYzODMwYTIzIiwiZmxvd0V4ZWN1dGlvblJlZiI6Ijc1ZDVhNDljLWYxNTktNDgwMC1iNzA1LTkwYzg1MTQ3ZDgyZCIsImZsb3dSZWYiOiI3ZmM5ZjJjNS05NGFmLTRhZDYtYTUxYS1mNDZjYTZhMjNhNTIiLCJvZmZlclJlZiI6IjNkYTc3OWY1LWEyOTEtNDViNi04YjE0LWQ4MDE4YTNiM2VlZiJ9",
      "Name": "Ancillary bundle",
      "imageURLForTesting": "https://png.icons8.com/ios/50/000000/cardboard-box.png"
    },
    {
    "trackingUrl": "https://{apiEndpoint}/v3/trackers/eyJjaGFubmVsIjoiV0VCIiwiZGVjaXNpb25Nb2RlbFJlZiI6IjAzOTBmZTNiLTVmNTItNGM4NC1iNTBjLWEzYzUyMGMzMzhjYiIsImRlY2lzaW9uTW9kZWxWYXJpYW50UmVmIjoiNjYwNWNhMDMtNWE1Ni00NGI2LWFmMTQtZjJlNTYzODMwYTIzIiwiZmxvd0V4ZWN1dGlvblJlZiI6Ijc1ZDVhNDljLWYxNTktNDgwMC1iNzA1LTkwYzg1MTQ3ZDgyZCIsImZsb3dSZWYiOiI3ZmM5ZjJjNS05NGFmLTRhZDYtYTUxYS1mNDZjYTZhMjNhNTIiLCJvZmZlclJlZiI6IjgyYjIzNzQ1LTljZjgtNDI0My1hZmQ5LWNkYzJlN2I4NWM4NiJ9",
      "Name": "Ancillary seat",
      "imageURLForTesting": "https://png.icons8.com/dotty/50/000000/flight-seat.png"
    },
    {
    "trackingUrl": "https://{apiEndpoint}/v3/trackers/eyJjaGFubmVsIjoiV0VCIiwiZGVjaXNpb25Nb2RlbFJlZiI6IjAzOTBmZTNiLTVmNTItNGM4NC1iNTBjLWEzYzUyMGMzMzhjYiIsImRlY2lzaW9uTW9kZWxWYXJpYW50UmVmIjoiNjYwNWNhMDMtNWE1Ni00NGI2LWFmMTQtZjJlNTYzODMwYTIzIiwiZmxvd0V4ZWN1dGlvblJlZiI6Ijc1ZDVhNDljLWYxNTktNDgwMC1iNzA1LTkwYzg1MTQ3ZDgyZCIsImZsb3dSZWYiOiI3ZmM5ZjJjNS05NGFmLTRhZDYtYTUxYS1mNDZjYTZhMjNhNTIiLCJvZmZlclJlZiI6IjliMjdmNzQ0LTg1ZmUtNDJkNi04NDBjLWE4YjJkMWRmMDcyMyJ9",
      "Name": "Ancillary bag",
      "imageURLForTesting": "https://png.icons8.com/metro/50/000000/suitcase.png",
      "nonDependent": "false"
    },
    {
    "trackingUrl": "https://{apiEndpoint}/v3/trackers/eyJjaGFubmVsIjoiV0VCIiwiZGVjaXNpb25Nb2RlbFJlZiI6IjAzOTBmZTNiLTVmNTItNGM4NC1iNTBjLWEzYzUyMGMzMzhjYiIsImRlY2lzaW9uTW9kZWxWYXJpYW50UmVmIjoiNjYwNWNhMDMtNWE1Ni00NGI2LWFmMTQtZjJlNTYzODMwYTIzIiwiZmxvd0V4ZWN1dGlvblJlZiI6Ijc1ZDVhNDljLWYxNTktNDgwMC1iNzA1LTkwYzg1MTQ3ZDgyZCIsImZsb3dSZWYiOiI3ZmM5ZjJjNS05NGFmLTRhZDYtYTUxYS1mNDZjYTZhMjNhNTIiLCJvZmZlclJlZiI6IjFiYmNhZTU3LWI1MzEtNDJlMy1hZjRhLTg4NmQ5MGJhMjgyNCJ9",
      "Name": "Ancillary insurance",
      "imageURLForTesting": "https://png.icons8.com/ios/50/000000/umbrella.png",
      "nonDependent": "false"
    }
]