サンプルメッセージ変換テンプレートの生成 get-sample-template-api-operations

IMPORTANT
API エンドポイントhttps://platform.adobe.io/data/core/activation/authoring/testing/template/sample

このページでは、宛先用にメッセージ変換テンプレートを生成するために、/authoring/testing/template/sample API エンドポイントを使用して実行できる、すべての API 操作を一覧表示および説明しています。 このエンドポイントでサポートされる機能の説明については、テンプレートの作成を参照してください。

サンプルテンプレート API 操作の概要 get-started

続行する前に、必要な宛先オーサリング権限と必要なヘッダーを取得する方法など、APIを正常に呼び出すために知っておく必要がある重要な情報については、入門ガイド ​を確認してください。

サンプルテンプレートの取得 generate-sample-template

authoring/testing/template/sample/ エンドポイントに対して GET リクエストを行い、作成しているテンプレートに基づいて宛先設定の宛先 ID を指定することで、サンプルテンプレートを取得できます。

TIP
  • ここで使用する必要がある宛先 ID は、宛先設定に対応した instanceId で、/destinations エンドポイントを使用して作成されています。 詳しくは、宛先設定の取得を参照してください。

API 形式

GET authoring/testing/template/sample/{DESTINATION_ID}
パラメーター
説明
{DESTINATION_ID}
メッセージ変換テンプレートを生成している宛先設定の ID。

リクエスト

以下のリクエストは、ペイロードで提供されるパラメーター設定に基づいて、新しいサンプルテンプレートを生成します。

curl --location --request GET 'https://platform.adobe.io/data/core/activation/authoring/testing/template/sample/5114d758-ce71-43ba-b53e-e2a91d67b67f' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-api-key: {API_KEY}' \
--header 'Authorization: Bearer {ACCESS_TOKEN}' \
--header 'x-gw-ims-org-id: {ORG_ID}' \
--header 'x-sandbox-name: {SANDBOX_NAME}' \

応答

応答が成功すると、HTTP ステータス 200 が、想定されるデータ形式に一致するように編集できるサンプルテンプレートと共に返されます。

指定する宛先 ID が、ベストエフォート集計と集計ポリシーの maxUsersPerRequest=1 を含む宛先設定に対応する場合、リクエストは、以下に類似したサンプルテンプレートを返します。

{#- THIS is an example template for a single profile -#}
{#- A '-' at the beginning or end of a tag removes all whitespace on that side of the tag. -#}
{
    "identities": [
    {%- for idMapEntry in input.profile.identityMap -%}
    {%- set namespace = idMapEntry.key -%}
        {%- for identity in idMapEntry.value %}
        {
            "type": "{{ namespace }}",
            "id": "{{ identity.id }}"
        }{%- if not loop.last -%},{%- endif -%}
        {%- endfor -%}{%- if not loop.last -%},{%- endif -%}
    {% endfor %}
    ],
    "segments": [
    {%- set first = true %}
    {%- for namespace in input.profile.segmentMembership %}
    {%- for segment in input.profile.segmentMembership[namespace.key] %}
    {%- if destination.namespaceSegmentAliases[namespace.key][segment.key] is defined %}
    {%- if not first %},{% endif %}
        {
            "id": "{{ segment.key }}",
            "status": "{{ segment.value.status }}",
            "qualificationTime": "{{ segment.value.lastQualificationTime }}"
        }
    {%- set first = false %}
    {%- endif %}
    {% endfor %}
    {% endfor %}
    ]
}

指定する宛先 ID が、設定可能な集計またはベストエフォート集計を含み、maxUsersPerRequest が 1 より大きい宛先サーバーテンプレートに対応する場合、リクエストは、以下に類似したサンプルテンプレートを返します。

{#- THIS is an example template for multiple profiles -#}
{#- A '-' at the beginning or end of a tag removes all whitespace on that side of the tag. -#}
{
    "profiles": [
    {%- for profile in input.profiles %}
        {
            "identities": [
            {%- for idMapEntry in profile.identityMap -%}
            {%- set namespace = idMapEntry.key -%}
                {%- for identity in idMapEntry.value %}
                {
                    "type": "{{ namespace }}",
                    "id": "{{ identity.id }}"
                }{%- if not loop.last -%},{%- endif -%}
                {%- endfor -%}{%- if not loop.last -%},{%- endif -%}
            {% endfor %}
            ],
            "segments": [
            {%- set first = true %}
            {%- for namespace in profile.segmentMembership %}
            {%- for segment in profile.segmentMembership[namespace.key] %}
            {%- if destination.namespaceSegmentAliases[namespace.key][segment.key] is defined %}
            {%- if not first %},{% endif %}
                {
                    "id": "{{ segment.key }}",
                    "status": "{{ segment.value.status }}",
                    "qualificationTime": "{{ segment.value.lastQualificationTime }}"
                }
            {%- set first = false %}
            {%- endif %}
            {% endfor %}
            {% endfor %}
            ]
        }{%- if not loop.last -%},{%- endif -%}
    {% endfor %}
    ]
}

API エラー処理 api-error-handling

Destination SDK API エンドポイントは、一般的な Experience Platform API エラーメッセージの原則に従います。 Experience Platform トラブルシューティングガイドのAPI ステータスコード ​および​ リクエストヘッダーエラーを参照してください。

次の手順 next-steps

このドキュメントでは、/authoring/testing/template/sample API エンドポイントを使用した、メッセージ変換テンプレートの生成方法を確認しました。 次に、レンダリングテンプレート API エンドポイントを使用して、テンプレートに基づいて書き出されたプロファイルを生成し、それらを宛先で想定されているデータ形式と比較できます。

recommendation-more-help
experience-platform-help-destinations