Using the Recommendations API

Our Recommendations API is used to personalised the Shopping experiences of your visitors.

What is a Widget?

A XO Widget is a recommendation Area on your customers' journey that is used to personalise your visitors' experiences. When requesting recommendations to XO, it's mandatory to provide the Widget ID of your recommendation Area.

Personalised Recommendation

Recommendation API

GET https://api.early-birds.io/widget/:widgetId/recommendations/:profileId/:variables

Get recommendations for a given user on a given recommendation Area

Path Parameters

Query Parameters

{
  "id": "f7c63760-04e4-11ec-9512-a1ffa08cee62",
  "recommendations": [
    {
      "id": "168",
      "strategy": "basic-mostPopular",
      "score": 10,
      "distribution": 0,
      "product": {
        "version": 0,
        "context": "default",
        "id": "168",
        "_id": {
          "original_id": "168",
          "tenant": "tenantId",
          "kind": "product"
        },
        "type": "physical",
        "title": "RONHILL TECH REVIVE RACER SHORTS - SS21",
        "url": "",
        "recommended": true,
        "booster": 0,
        "price": 0,
        "discount_rate": 0,
        "metadata": {
          "updated": "1627293494427"
        },
        "categories": [
          "BRAND_ronhill",
          "COLOR_racingred-briwhite",
          "GENDER_mens",
          "SPORT_running",
          "TYPE_shorts"
        ],
        "photo": "https://cdn11.bigcommerce.com/s-pv1wa8pmo1/products/168/images/432/RON3364_1000_1__60313__86323.1625826863.386.513.jpg?c=1",
        "is_price_hidden": 0,
        "warranty": "",
        "inventory_warning_level": 0,
        "height": 0,
        "brand_name": "RonHill",
        "cost_price_GBP": 0,
        "map_prices_GBP": 0,
        "open_graph_use_meta_description": 1,
        "mpn": "",
        "base_variant_id": "0",
        "preorder_message": "",
        "option_set_display": "right",
        "brand_image_url": "",
        "brand_custom_url": "/ronhill/",
        "search_keywords": "",
        "gtin": "",
        "meta_description": "",
        "is_condition_shown": 0,
        "custom_url": "/ronhill-tech-revive-racer-shorts-ss21/",
        "open_graph_description": "",
        "sku": "ron3364",
        "is_preorder_only": 0,
        "Brand": "RonHill",
 
      }
    },
    {
      "id": "146",
      "strategy": "basic-mostPopular",
      "score": 9.960938334216266,
      "distribution": 0,
      "product": {
        "version": 0,
        "context": "default",
        "id": "146",
        "_id": {
          "original_id": "146",
          "tenant": "tenantId",
          "kind": "product"
        },
        "type": "physical",
        "title": "OMM Kamleika Running Jacket",
        "url": "",
        "recommended": true,
        "booster": 0,
        "price": 0,
        "discount_rate": 0,
        "metadata": {
          "updated": "1627293494412"
        },
        "categories": [
          "BRAND_omm",
          "COLOR_black",
          "GENDER_mens",
          "SPORT_running",
          "TYPE_trail"
        ],
        "photo": "https://cdn11.bigcommerce.com/s-pv1wa8pmo1/products/146/images/410/OMM202_1000_1__41292__87669.1625826850.386.513.jpg?c=1",
        "is_price_hidden": 0,
        "warranty": "",
        "inventory_warning_level": 0,
        "height": 0,
        "brand_name": "OMM",
        "cost_price_GBP": 0,
        "map_prices_GBP": 0,
        "open_graph_use_meta_description": 1,
        "mpn": "",
        "base_variant_id": "0",
        "preorder_message": "",
        "option_set_display": "right",
        "brand_image_url": "",
        "brand_custom_url": "/omm/",
        "search_keywords": "",
        "gtin": "",
        "meta_description": "",
        "is_condition_shown": 0,
        "custom_url": "/omm-kamleika-running-jacket/",
        "open_graph_description": "",
        "sku": "omm202",
        "is_preorder_only": 0,
        "Brand": "OMM",
      }
    },
    {
      "id": "145",
      "strategy": "basic-mostPopular",
      "score": 9.535014093127474,
      "distribution": 0,
      "product": {
        "version": 0,
        "context": "default",
        "id": "145",
        "_id": {
          "original_id": "145",
          "tenant": "tenantId",
          "kind": "product"
        },
        "type": "physical",
        "title": "Ronhill Tech GORE-TEX ShakeDry Jacket - SS21",
        "url": "",
        "recommended": true,
        "booster": 0,
        "price": 0,
        "discount_rate": 0,
        "metadata": {
          "updated": "1627293494399"
        },
        "categories": [
          "BRAND_ronhill",
          "COLOR_black",
          "GENDER_mens",
          "SPORT_running",
          "TYPE_jackets"
        ],
        "photo": "https://cdn11.bigcommerce.com/s-pv1wa8pmo1/products/145/images/409/RON3191_1000_1__26277__67822.1625826849.386.513.jpg?c=1",
        "is_price_hidden": 0,
        "warranty": "",
        "inventory_warning_level": 0,
        "height": 0,
        "brand_name": "RonHill",
        "cost_price_GBP": 0,
        "map_prices_GBP": 0,
        "open_graph_use_meta_description": 1,
        "mpn": "",
        "base_variant_id": "0",
        "preorder_message": "",
        "option_set_display": "right",
        "brand_image_url": "",
        "brand_custom_url": "/ronhill/",
        "search_keywords": "",
        "gtin": "",
        "meta_description": "",
        "is_condition_shown": 0,
        "custom_url": "/ronhill-tech-gore-tex-shakedry-jacket-ss21/",
        "open_graph_description": "",
        "sku": "ron3191",
        "is_preorder_only": 0,
        "Brand": "RonHill",
      }
    },
    {
      "id": "226",
      "strategy": "basic-mostPopular",
      "score": 9.465919230788467,
      "distribution": 0,
      "product": {
        "version": 0,
        "context": "default",
        "id": "226",
        "_id": {
          "original_id": "226",
          "tenant": "tenantId",
          "kind": "product"
        },
        "type": "physical",
        "title": "Adidas Own The Run Women's T-Shirt - AW21",
        "url": "",
        "recommended": true,
        "booster": 0,
        "price": 0,
        "discount_rate": 0,
        "metadata": {
          "updated": "1627293494381"
        },
        "categories": [
          "BRAND_adidas",
          "COLOR_black",
          "GENDER_womens",
          "SPORT_running-gym",
          "TYPE_t-shirts"
        ],
        "photo": "https://cdn11.bigcommerce.com/s-pv1wa8pmo1/products/226/images/495/ADI14503_1000_1__71261.1626887677.386.513.jpg?c=1",
        "is_price_hidden": 0,
        "warranty": "",
        "inventory_warning_level": 0,
        "height": 0,
        "brand_name": "Adidas",
        "cost_price_GBP": 0,
        "map_prices_GBP": 0,
        "open_graph_use_meta_description": 1,
        "mpn": "",
        "base_variant_id": "0",
        "preorder_message": "",
        "option_set_display": "right",
        "brand_image_url": "",
        "brand_custom_url": "/adidas/",
        "search_keywords": "",
        "gtin": "",
        "meta_description": "",
        "is_condition_shown": 0,
        "custom_url": "/adidas-own-the-run-womens-t-shirt-aw21/",
        "open_graph_description": "",
        "sku": "adi14503",
        "is_preorder_only": 0,
        "Brand": "Adidas",
      }
    }
  ],
  "pagination": {
    "total": 4
  },
  "widget": {
    "title": "Most Popular",
    "attributes": {},
    "minResults": -1
  }
}

Example of call:

curl  "http://api.early-birds.io/widget/{{widgetId}}/recommendations/{{profileId}}?
        variables={
          '$productId': {{productId}},
          '$category': {{category}}
        }"
      -X GET 
      -H "Content-Type: application/json"

Available metadata options :

Adding the variables query parameter is provided as an example. Even if you are not requesting the API with a profileId, adding the context in which you want to get a recommendation is still a good practice.

Recommendation for a specific User - When using CADP

If you use CADP and identity Repository, when your user is identified through an identifier (for example after user login), you must use this identifier to request recommendations.

See Managing identities to learn more about Identities.

UserID (or any loggedin id):

curl  "https://api.early-birds.io/widget/{{widgetId}}/recommendations/{{identityRepository}}/{{userId}}/"
      -X GET 
      -H "Content-Type: application/json"

Where:

  • {{widgetId}} with the widget ID that you would like to display

  • {{identityRepository}} with the identity repository that you are using

  • {{userId}} is the id of the identified user

Recommendation for a specific User - When not using CADP

It is possible to request the API using your own visitor referential:

curl  "http://api.early-birds.io/widget/{{widgetId}}/recommendations/{{datasourceId}}/{{userId}}"
      -X GET
      -H "Content-Type: application/json"

Where:

  • {{widgetId}} with the widget ID that you would like to display

  • {{datasourceId}} with the datasource ID (ID of your own visitor referential)

  • {{userId}} with the visitor ID in your own referential

Adding the variables query parameter is provided as an example. Even if you are not requesting the API with a profileId, adding the context in which you want to get a recommendation is still a good practice.

Anonymous recommendation

For many reasons, you might need to request the Recommendation API without providing a profileId. It can be done by calling our API without providing a profileId.

curl  "http://api.early-birds.io/widget/{{widgetId}}/recommendations?
        variables={
          '$productId': {{productId}},
          '$category': {{category}}
        }"
      -X GET 
      -H "Content-Type: application/json"

Where:

  • {{widgetId}} with the widget ID that you would like to display

  • {{productId}} Product ID if you are on the product page

  • {{category}} Category users are currently viewing

Adding the variables query parameter is provided as an example. Even if you are not requesting the API with a profileId, adding the context in which you want to get a recommendation is still a good practice.

Requesting multiple recommendation Area at the same time

To retrieve results for multiple recommendation areas, you can use the following endpoint:

Multiple widgets

GET https://api.early-birds.io/widget/multi/:widgetIds/recommendations/:profileId

To retrieve results for multiple recommendation areas, you can use this endpoint. The

only

difference with the Recommendation API is the

widgetIds

.

\

\

⚠️ Does not work with CADP (sessionId)

Path Parameters

Emails recommendation

Following API calls have been created to generate a recommendation directly through email HTML code. Each call will return a unique item recommendation.

If email is implemented through API, or through a CSV file exchange, it’s not recommended to use the following calls. The widget API calls described earlier can be used to retrieve all the items recommended through a single API call.

Image generation for a user ID

This API endpoint will return the generated image for the recommended item.

Usually, this method is used directly in an HTML tag and is not called as a standard API endpoint. You can switch to “Tags” in the right column to see how it works.

curl  "http://api.early-birds.io/widget/{{widgetId}}/recommendations/{{datasourceId}}/{{userId}}/{{index}}/photo.png"
      -X GET

Where:

  • {{widgetId}} with the widget ID that you would like to display

  • {{datasourceId}} with the datasource ID (ID of your own visitor referential)

  • {{userId}} with the visitor ID in your own referential

  • {{index}} item position (example: 1, 2, 3, ...)

curl  "http://api.early-birds.io/widget/{{widgetId}}/recommendations/{{datasourceId}}/{{userId}}/{{index}}/redirect.html"
      -X GET

Where:

  • {{widgetId}} with the widget ID that you would like to display

  • {{datasourceId}} with the datasource ID (ID of your own visitor referential)

  • {{userId}} with the visitor ID in your own referential

  • {{index}} item position (example: 1, 2, 3, ...)

Last updated