Skip to main content

Running experiments using IDs in Sitecore CDP REST API

Abstract

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

You can programmatically run experiments using the friendlyID attribute. When you create an experiment, Sitecore CDP automatically creates an ID when you name the experiment. For example, if you name the experiment Product Recommender, Sitecore CDP automatically generates an ID named product_recommender.

In some organizations there might be several variations of an experience named Product Recommender that have different page targets, audience filters, or other conditions that must be met in order for the experience to run.

To use this same example, users might intentionally delete some of the experiences named Product Recommender after the marketing campaign is retired. This can often happen across regions. To support referential integrity, Sitecore CDP automatically appends a numeral to the value of the friendlyID attribute if the name of the experience you create is identical to any names of deleted experiences. For example, Sitecore CDP automatically appends a numeral 2 so the friendlyID attribute value is product_recommender_2.

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

POST: https://apiEndpoint/v2/callFlows

The following is a request that uses the friendlyId attribute:

{
    "channel": "WEB",
    "language": "en",
    "currencyCode": "EUR",
    "pointOfSale": "eupos",
    "browserId": "e0lle18b-05bC-43baf-98c8-a11739304b6",
    "clientKey": "lbbSTATw12v5a9ffHPW1c4hAM73GxQ",
    "friendlyId":"product_recommender"
}

To apply fuzzy matching so that Sitecore CDP executes the first lexicographical match of the friendlyId, you pass in product_recommender* as the value for the friendlyID attribute. You can use an asterix to apply Lexicographical order and execute the first live experience that matches and passes any other conditions such as page targeting and real-time audience filters.