---
title: "イベントAPIの呼び出し"
slug: "calling-the-events-api"
abstract: "Sitecore SearchイベントをAPI呼び方を説明しています。"
---
# イベントAPIの呼び出し

Sitecore SearchイベントAPIのHTTPSプロトコルをサポートしています。APIはJSONオブジェクトの形でリクエストを受け付けます。

## API URLと方法

Searchの**Developer Resources**セクションの**API Access**タブで、あなたのパーソナライズされたイベントAPI URLを見つけることができます。

URLは以下の構造で作成されます: https://discover.sitecorecloud.io/event/<ckey>/v4/publish。 ckeyは顧客キーで、アカウントIDとドメインIDの組み合わせで、以下の形式で示されています: <accountID>-<domainID>。

Events APIはPOSTメソッドのみをサポートしています。

## 認証

リクエストと一緒に[APIキー](https://doc.sitecore.com/search/ja/developers/search-developer-guide/integrating-using-rest-apis/api-authentication-and-authorization.html "API authentication and authorization") を渡す必要があります。

## 必要な鍵

以下の表は、Events APIに必要なキーを示しています:

キー

種類

概要

data

JSON 文字列

[イベントオブジェクト](urn:resource:component:958992)を表すJSONです。

## 例

以下はEvents APIへのPOST requestの例です:

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

以下はEvents APIへの [ページビューイベント](https://doc.sitecore.com/search/ja/developers/search-developer-guide/integrating-using-rest-apis/using-the-events-api-to-track-events/funnel-events/creating-an-entity-page-view-event.html "Creating an entity page view event") リクエストの例です:

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"
 }
 
 }
}'