---
title: "インタラクティブな体験のためにAPIレスポンスを作成します"
slug: "compose-the-api-response-for-an-interactive-experience"
abstract: "インタラクティブな体験のためのAPIレスポンスの作成方法の詳細を提供します。"
---
# インタラクティブな体験のためにAPIレスポンスを作成します

組織のウェブサイトにデータを送るためのAPIレスポンスを作成し、ウェブページ上でオファーやコンテンツを正しく表示する必要があります。 [意思決定モデルから返されたオファーやコンテンツを](https://doc.sitecore.com/personalize/ja/users/sitecore-personalize/introduction-to-experiments-in-sitecore-personalize/introduction-to-interactive-experiments-in-sitecore-personalize/compose-the-api-response-for-an-interactive-experiment/use-dynamic-decision-model-data-in-the-api-response-for-an-interactive-experiment.html "Use dynamic decision model data in the API response for an interactive experiment")APIレスポンスに含めることができます。

API応答を作成する際には、組織のウェブサイトがオファーやコンテンツを正しく表示するために必要とするパラメータを入力しなければなりません。 [インタラクティブな実験回答から動的データをコピー&ペースト](https://doc.sitecore.com/personalize/ja/users/sitecore-personalize/introduction-to-experiments-in-sitecore-personalize/introduction-to-interactive-experiments-in-sitecore-personalize/compose-the-api-response-for-an-interactive-experiment.html "Compose the API response for an interactive experiment") してAPI応答に貼り付けることができます。これは、依存するウェブサイトが要求する"uri"、"region"、"pointOfSale"などのパラメータをAPI応答に含みたい場合は必須です。

また、APIレスポンスに [動的なゲストデータ](https://doc.sitecore.com/personalize/ja/users/sitecore-personalize/introduction-to-experiments-in-sitecore-personalize/introduction-to-interactive-experiments-in-sitecore-personalize/compose-the-api-response-for-an-interactive-experiment/use-dynamic-guest-data-in-the-api-response-for-an-interactive-experiment.html "Use dynamic guest data in the API response for an interactive experiment") を含めることもできます。例えば、インタラクティブ体験のバリアントにゲストの名前、所在地、ロイヤルティ番号などを含めるようにしたい場合もあります。そのためには、バリアントに動的データを含めるように設定し、バリアントが実行された際にサーバーが動的データを要求し、組織のウェブサイトに渡すように設定する必要があります。

インタラクティブな体験のためのAPI応答を作成するには:

1.  APIエディターの**API**タブでFreeMarkerを使ってAPI応答を作成します。
    
    ![Composing the API response using FreeMarker](https://doc.sitecore.com/api/markdown-image/personalize/ja/users/sitecore-personalize/images/pers_apirequestint.png)
    
    > !ヒント必要に応じて [、ゲストデータモデル](https://doc.sitecore.com/personalize/ja/users/sitecore-personalize/introduction-to-experiences/introduction-to-interactive-experiences/use-dynamic-guest-data-in-the-api-response-for-an-interactive-experiment.html "Use dynamic guest data in the API response for an interactive experiment") や [意思決定モデルの応答](https://doc.sitecore.com/personalize/ja/users/sitecore-personalize/introduction-to-experiences/introduction-to-interactive-experiences/use-dynamic-decision-model-data-in-the-api-response-for-an-interactive-experiment.html "Use dynamic decision model data in the API response for an interactive experiment")から動的データをコピー&ペーストできます。また、APIエディターで直接入力して、応答の一部をコンテキスト属性に置き換えることもできます。 ${guest.firstName}.
    
2.  **「保存**」をクリックします。
    
3.  APIエディターを閉じるには ![back.png](https://doc.sitecore.com/api/markdown-image/personalize/ja/users/sitecore-personalize/images/back.png) をクリックしてください。
    
    > !注**お知らせ**システムの応答時間の100%をカバーするために、システムの応答に600ミリ秒のタイムアウトを設定することをお勧めします。これにはサーバーとの通信にかかる潜在的なネットワーク時間は含まれていません。クライアントごとに異なるクライアントサーバーの位置も考慮してください。API応答に依存するクライアントに対して設定したすべてのタイムアウトは、例えば動的オファーのUIレンダリングなど、それに応じて調整してください。