Skip to main content
Sitecore Documentation
  • Learn
  • Downloads
  • Changelog
  • Roadmap
PersonalizeCloud Portal
Sitecore Personalize developer documentation
  • 開発Sitecore Personalize
    • ベースURL
    • レスポンスコード
        • テンプレートを作成する
        • テンプレートの取得
        • テンプレートの取得
        • テンプレートを更新する
        • テンプレートのリビジョンを取得する
        • テンプレートのリビジョンを取得する
        • プレビュー テンプレート
        • テンプレート コードのプレビュー
  1. テンプレートREST API
  1. REST API
  2. テンプレートREST API
  3. プレビュー テンプレート

プレビュー テンプレート

日本語翻訳に関する免責事項

このページの翻訳はAIによって自動的に行われました。可能な限り正確な翻訳を心掛けていますが、原文と異なる表現や解釈が含まれる場合があります。正確で公式な情報については、必ず英語の原文をご参照ください。

POST /v3/templates/renderTemplates

このエンドポイントを使用すると、Sitecore Personalizeに既に存在するテンプレートをテストできます。

リクエストには、1つ以上のテンプレートのfriendlyIdを含めます。また、テンプレートがレンダリングされるときにテンプレート パラメーターを置き換えるテンプレート変数値も含まれます。応答では、要求で指定したテンプレート (テンプレート変数値を含む) が返されます。

少なくとも、要求本文にtemplatesというオブジェクトを指定する必要があります。 templatesオブジェクトには、テストするすべてのテンプレートのオブジェクトを含める必要があります。これらのオブジェクトには、object1やobject2など、任意の名前を選択できます。これらの各オブジェクトには、次の属性が含まれている必要があります。

属性

種類

形容

使用例

friendlyId

糸

テンプレートの一意のID。

"alert_bar_template_1"

templateParams

オブジェクト

テンプレート変数とそれに対応する値。

{ "Name": "John", "ProductType": "sneakers" }

リクエストには、テストするテンプレートのfriendlyId変数とテンプレート変数の値を含めます。

curl -X POST '<baseURL>/v3/templates/renderTemplates' \
-H 'Authorization: Bearer <accessToken>' \
-H 'Accept: application/json' \
--data-raw '
{
  "templates": {
    "object1": {
      "friendlyId": "alert_bar_template_1",
      "templateParams": {
        "ProductType": "sneakers"
      }
    },
    "object2": {
      "friendlyId": "alert_bar_template_2",
      "templateParams": {
        "MemberCardType": "VIP"
      }
    }
  }
}'

応答では、テンプレート変数の値 ( sneakersやVIPなど) を含むテンプレート全体が返されます。

{
  "renderedTemplates": {
    "object1": [
      {
        "id": "html",
        "template": "<div>Find sneakers for men</div>"
      },
      {
        "id": "css",
        "template": "background-color: var(--page-sneakers-bg-color);"
      }
    ],
    "object2": [
      {
        "id": "html",
        "template": "<p>As a VIP member, you get the following benefits:<p>"
      }
    ]
  }
}
 
この記事を改善するための提案がある場合は、 お知らせください!

Documentation Assistant

This assistant uses AI to generate responses based on Sitecore documentation. While it has access to official sources, answers may be incomplete or inaccurate and should not be considered official advice or support.
Powered by
k
kapa.ai
Protected by reCAPTCHA

© Copyright 2026, Sitecore A/S or a Sitecore affiliated company.
All rights reserved.

Privacy policySitecore Trust CenterTerms of use