Calling the Events API

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

API URL and methods

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 URL is created using the following structure: https://discover.sitecorecloud.io/event/<ckey>/v4/publish. The ckey is your customer key, a combination of your Account ID and your Domain ID in the following format: <accountID>-<domainID>.

The Events API supports only the POST method.

Authentication

You must pass an API key along with your request.

Required keys

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

Key

Type

Description

data

JSON string

JSON representing the event object.

Examples

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

RequestResponse
POST /event/{ckey}/v4/publish
{
 "data": "{<event object>}"
}

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

RequestResponse
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",
    "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"
        }
      ]
    }
}'

Do you have some feedback for us?

If you have suggestions for improving this article,