擷取對象範本

IMPORTANT
API端點platform.adobe.io/data/core/activation/authoring/audience-templates

此頁面以範例說明可用於擷取對象中繼資料範本的API請求和裝載,使用 /authoring/audience-templates api端點。

如需可透過此端點設定的功能的詳細說明,請參閱 對象中繼資料管理.

IMPORTANT
Destination SDK支援的所有引數名稱和值如下 區分大小寫. 為避免區分大小寫錯誤,請完全依照檔案中所示使用引數名稱和值。

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

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

擷取對象範本 retrieve

您可以透過建立對象範本 GET 要求給 /authoring/audience-templates 端點。

API格式

使用下列API格式來擷取您帳戶的所有受眾範本。

GET /authoring/audience-templates

使用下列API格式來擷取特定的受眾範本,其定義為 {INSTANCE_ID} 引數。

GET /authoring/audience-templates/{INSTANCE_ID}

以下兩個請求會擷取您IMS組織的所有受眾範本或特定受眾範本,端視您是否傳遞 INSTANCE_ID 請求中的引數。

選取下方的每個索引標籤以檢視對應的裝載。

擷取所有對象範本

以下請求將根據 IMS Org ID 和沙箱設定。

accordion
請求
code language-shell
curl -X GET https://platform.adobe.io/data/core/activation/authoring/audience-templates \
 -H 'Authorization: Bearer {ACCESS_TOKEN}' \
 -H 'x-gw-ims-org-id: {ORG_ID}' \
 -H 'x-api-key: {API_KEY}' \
 -H 'x-sandbox-name: {SANDBOX_NAME}'
accordion
回應

成功的回應會根據「 」傳回HTTP狀態200,其中包含您可存取的對象範本清單 IMS Org ID 以及您使用的沙箱名稱。 一 instanceId 對應至一個對象範本。

code language-json
{
   "instanceId":"34ab9cc2-2536-44a5-9dc5-b2fea60b3bd6",
   "createdDate":"2021-07-26T19:30:52.012490Z",
   "lastModifiedDate":"2021-07-27T21:25:42.763478Z",
   "metadataTemplate":{
      "create":{
         "url":"https://api.moviestar.com/v1/adaccounts/{{customerData.accountId}}/segments",
         "httpMethod":"POST",
         "headers":[
            {
               "value":"application/json",
               "header":"Content-Type"
            },
            {
               "value":"Bearer {{oauth2ServiceAccessToken}}",
               "header":"Authorization"
            }
         ],
         "requestBody":{
            "json":{
               "segments":[
                  {
                     "name":"{{segment.name}}",
                     "description":"{{segment.description}}",
                     "source_type":"FIRST_PARTY",
                     "ad_account_id":"{{customerData.accountId}}",
                     "retention_in_days":180
                  }
               ]
            }
         },
         "responseFields":[
            {
               "value":"{{body.segments[0].segment.id}}",
               "name":"externalAudienceId"
            }
         ],
         "responseErrorFields":[
            {
               "value":"{{root}}",
               "name":"message"
            }
         ]
      },
      "update":{
         "url":"https://adsapi.moviestar.com/v1/adaccounts/{{customerData.accountId}}/segments",
         "httpMethod":"PUT",
         "headers":[
            {
               "value":"application/json",
               "header":"Content-Type"
            },
            {
               "value":"Bearer {{oauth2ServiceAccessToken}}",
               "header":"Authorization"
            }
         ],
         "requestBody":{
            "json":{
               "segments":[
                  {
                     "id":"{{segment.alias}}",
                     "name":"{{segment.name}}",
                     "description":"{{segment.description}}"
                  }
               ]
            }
         },
         "responseFields":[
            {
               "value":"{{body.segments[0].segment.id}}",
               "name":"externalAudienceId"
            }
         ],
         "responseErrorFields":[
            {
               "value":"{{root}}",
               "name":"message"
            }
         ]
      },
      "delete":{
         "url":"https://adsapi.moviestar.com/v1/segments/{{segment.alias}}",
         "httpMethod":"DELETE",
         "headers":[
            {
               "value":"application/json",
               "header":"Content-Type"
            },
            {
               "value":"Bearer {{oauth2ServiceAccessToken}}",
               "header":"Authorization"
            }
         ],
         "responseErrorFields":[
            {
               "value":"{{root}}",
               "name":"message"
            }
         ]
      },
      "name":"Moviestar destination audience template - Example 1"
   }
}
擷取特定對象範本

以下請求將根據 IMS Org ID 和沙箱設定。

accordion
請求
code language-shell
curl -X GET https://platform.adobe.io/data/core/activation/authoring/audience-templates/{INSTANCE_ID} \
 -H 'Authorization: Bearer {ACCESS_TOKEN}' \
 -H 'x-gw-ims-org-id: {ORG_ID}' \
 -H 'x-api-key: {API_KEY}' \
 -H 'x-sandbox-name: {SANDBOX_NAME}'
table 0-row-2 1-row-2
參數 說明
{INSTANCE_ID} 您要擷取之對象範本的ID。
accordion
回應

成功的回應會傳回HTTP狀態200,其中包含與對應的對象範本詳細資訊 {INSTANCE_ID} 通話時提供。

code language-json
{
   "instanceId":"34ab9cc2-2536-44a5-9dc5-b2fea60b3bd6",
   "createdDate":"2021-07-26T19:30:52.012490Z",
   "lastModifiedDate":"2021-07-27T21:25:42.763478Z",
   "metadataTemplate":{
      "create":{
         "url":"https://api.moviestar.com/v1/adaccounts/{{customerData.accountId}}/segments",
         "httpMethod":"POST",
         "headers":[
            {
               "value":"application/json",
               "header":"Content-Type"
            },
            {
               "value":"Bearer {{oauth2ServiceAccessToken}}",
               "header":"Authorization"
            }
         ],
         "requestBody":{
            "json":{
               "segments":[
                  {
                     "name":"{{segment.name}}",
                     "description":"{{segment.description}}",
                     "source_type":"FIRST_PARTY",
                     "ad_account_id":"{{customerData.accountId}}",
                     "retention_in_days":180
                  }
               ]
            }
         },
         "responseFields":[
            {
               "value":"{{body.segments[0].segment.id}}",
               "name":"externalAudienceId"
            }
         ],
         "responseErrorFields":[
            {
               "value":"{{root}}",
               "name":"message"
            }
         ]
      },
      "update":{
         "url":"https://adsapi.moviestar.com/v1/adaccounts/{{customerData.accountId}}/segments",
         "httpMethod":"PUT",
         "headers":[
            {
               "value":"application/json",
               "header":"Content-Type"
            },
            {
               "value":"Bearer {{oauth2ServiceAccessToken}}",
               "header":"Authorization"
            }
         ],
         "requestBody":{
            "json":{
               "segments":[
                  {
                     "id":"{{segment.alias}}",
                     "name":"{{segment.name}}",
                     "description":"{{segment.description}}"
                  }
               ]
            }
         },
         "responseFields":[
            {
               "value":"{{body.segments[0].segment.id}}",
               "name":"externalAudienceId"
            }
         ],
         "responseErrorFields":[
            {
               "value":"{{root}}",
               "name":"message"
            }
         ]
      },
      "delete":{
         "url":"https://adsapi.moviestar.com/v1/segments/{{segment.alias}}",
         "httpMethod":"DELETE",
         "headers":[
            {
               "value":"application/json",
               "header":"Content-Type"
            },
            {
               "value":"Bearer {{oauth2ServiceAccessToken}}",
               "header":"Authorization"
            }
         ],
         "responseErrorFields":[
            {
               "value":"{{root}}",
               "name":"message"
            }
         ]
      },
      "name":"Moviestar destination audience template - Example 1"
   }
}

API錯誤處理 error-handling

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

後續步驟 next-steps

閱讀本檔案後,您現在知道如何使用 /authoring/destination-servers api端點。 讀取 如何使用Destination SDK來設定您的目的地 以瞭解此步驟在設定目的地的程式中的適用位置。

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