Skip to main content

Calling the Events API

Abstract

Describes how to call the Sitecore Search Events API.

Sitecore Search supports the HTTPS protocol for the Events API. The API accepts requests in the form of JSON objects.

You can find your personalized Events API URL in the Customer Engagement Console (CEC) on the Developer Resources page, on the API Access tab.

The Events API supports only the POST method.

You must pass an API key along with your request.

The following table lists the required keys for the Events API:

Key

Type

Description

ckey

string

Unique customer key constructed using the account_id and domain_hash of the domain. This can be retrieved from the API Access tab of the Developer Resources page of the CEC.

data

JSON string

JSON representing the event object.

The following is an example of a POST request to the Events API:

POST {EVENT_URL}
{
 "data": "{<event object>}"
}

The following is an example of a page view event request to the Events API:

curl --location --request POST 'https://discover.sitecorecloud.io/event/17595242-159871555/v4/publish' \
--header 'Content-Type: text/plain' \
--header 'Authorization: 01-847028a3-e6593de0a4fd3183cec60650f855982ca00c2720' \
--data-raw '{
    "name": "entity_page",
    "action": "view",
    "ckey": "17595242-159871555",
    "client_time_ms": 1660088972963,
    "user_id": "j4y9f17bqqlrqtl36uqfadfadfadf",
    "value": {
      "context": {
        "geo": {
          "ip": "18.233.241.14"
        },
        "browser": {
          "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36"
        },
        "page": {
          "uri": "https://www.sitecore.com/products/content-cloud"
        }
      },
      "entities": [
        {
          "id": "https___www_sitecore_com_products_content-cloud",
          "uri": "https://www.sitecore.com/products/content-cloud"
          "entity_type": "content"
        }
      ]
    }
}'