產生範例訊息轉換範本 get-sample-template-api-operations

IMPORTANT
API端點https://platform.adobe.io/data/core/activation/authoring/testing/template/sample

此頁面列出並描述您可以使用執行的所有API作業。 /authoring/testing/template/sample API端點,以產生 訊息轉換範本 以取得您的目的地。 如需此端點支援的功能的說明,請閱讀 建立範本.

範例範本API操作快速入門 get-started

在繼續之前,請檢閱 快速入門手冊 如需成功呼叫API所需的重要資訊,包括如何取得必要的目的地撰寫許可權和必要的標頭。

取得範例範本 generate-sample-template

您可以透過向以下網站發出GET請求來取得範例範本: authoring/testing/template/sample/ 端點,並提供您建立範本時依據之目的地設定的目的地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 %}
    ],
    "AdobeExperiencePlatformSegments": {
        "add": [
        {%- for segment in input.profile.segmentMembership.ups | added %}
            "{{ segment.key }}"{%- if not loop.last -%},{%- endif -%}
        {% endfor %}
        ],
        "remove": [
        {#- Alternative syntax for filtering audiences by status: -#}
        {% for segment in removedSegments(input.profile.segmentMembership.ups) %}
            "{{ segment.key }}"{%- if not loop.last -%},{%- endif -%}
        {% endfor %}
        ]
    }
}

如果您提供的目的地ID對應至目的地伺服器範本,並附有 可設定的彙總最大努力彙總 替換為 maxUsersPerRequest 大於一個時,請求會傳回類似以下的範例範本:

{#- 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 %}
            ],
            "AdobeExperiencePlatformSegments": {
                "add": [
                {%- for segment in profile.segmentMembership.ups | added %}
                    "{{ segment.key }}"{%- if not loop.last -%},{%- endif -%}
                {% endfor %}
                ],
                "remove": [
                {#- Alternative syntax for filtering audiences by status: -#}
                {% for segment in removedSegments(profile.segmentMembership.ups) %}
                    "{{ segment.key }}"{%- if not loop.last -%},{%- endif -%}
                {% endfor %}
                ]
            }
        }{%- if not loop.last -%},{%- endif -%}
    {% endfor %}
    ]
}

API錯誤處理 api-error-handling

Destination SDKAPI端點遵循一般Experience PlatformAPI錯誤訊息原則。 請參閱 API狀態代碼請求標頭錯誤 (在平台疑難排解指南中)。

後續步驟 next-steps

閱讀本檔案後,您現在知道如何使用 /authoring/testing/template/sample api端點。 接下來,您可以使用 轉譯器範本API端點 根據範本產生匯出的設定檔,並與目的地的預期資料格式進行比較。

recommendation-more-help
7f4d1967-bf93-4dba-9789-bb6b505339d6