建立決定

您可以透過向以下傳送POST請求來建立決策: Offer Library API,同時提供容器ID。

Accept和Content-Type標題

下表顯示包含 Content-TypeAccept 請求標頭中的欄位:

標頭名稱
Accept application/vnd.adobe.platform.xcore.xdm.receipt+json; version=1
Content-Type application/schema-instance+json; version=1; schema="https://ns.adobe.com/experience/offer-management/offer-activity;version=0.5"

API格式

POST /{ENDPOINT_PATH}/{CONTAINER_ID}/instances
參數 說明 範例
{ENDPOINT_PATH} 存放庫API的端點路徑。 https://platform.adobe.io/data/core/xcore/
{CONTAINER_ID} 決策所在的容器。 e0bd8463-0913-4ca1-bd84-6309134ca1f6

要求

curl -X POST \
  'https://platform.adobe.io/data/core/xcore/e0bd8463-0913-4ca1-bd84-6309134ca1f6/instances' \
  -H 'Accept: application/vnd.adobe.platform.xcore.xdm.receipt+json; version=1' \
  -H 'Content-Type: application/schema-instance+json; version=1;  schema="https://ns.adobe.com/experience/offer-management/offer-activity;version=0.5"' \
  -H 'Authorization: Bearer {ACCESS_TOKEN}' \
  -H 'x-api-key: {API_KEY}' \
  -H 'x-gw-ims-org-id: {IMS_ORG}' \
  -H 'x-sandbox-name: {SANDBOX_NAME}' \
  -d '{
      "_instance": {
          "xdm:name": "Test API",
          "xdm:startDate": "2022-01-20T16:00:00Z",
          "xdm:endDate": "2022-01-27T16:00:00Z",
          "xdm:status": "live",
          "xdm:criteria": [
              {
                  "xdm:placements": [
                      "xcore:offer-placement:1457f9322f005194"
                  ],
                  "xdm:optionSelection": {
                      "xdm:filter": "xcore:offer-filter:1457f93227d0b6f0"
                  }
              }
          ],
          "xdm:fallback": "xcore:fallback-offer:13c259399d8bf013"
      },
      "_links": {}
  }'

回應

成功的回應會傳回關於新建立決定的資訊,包括其唯一的執行個體ID和位置 @id. 您可在後續步驟中使用執行個體ID來更新或刪除您的決定。

{
    "instanceId": "f88c9be0-1245-11eb-8622-b77b60702882",
    "@id": "xcore:offer-activity:124b79dc3ce2d720",
    "repo:etag": 1,
    "repo:createdDate": "2020-10-19T20:02:09.694067Z",
    "repo:lastModifiedDate": "2020-10-19T20:02:09.694067Z",
    "repo:createdBy": "{CREATED_BY}",
    "repo:lastModifiedBy": "{MODIFIED_BY}",
    "repo:createdByClientId": "{CREATED_CLIENT_ID}",
    "repo:lastModifiedByClientId": "{MODIFIED_CLIENT_ID}"
}

本頁內容