You can create a decision by making a POST request to the Offer Library API, while providing your container ID.
The following table shows the valid values which comprise the Content-Type and Accept fields in the request header:
Header name | Value |
---|---|
Content-Type | application/json |
API format
POST /{ENDPOINT_PATH}/{CONTAINER_ID}/instances
Parameter | Description | Example |
---|---|---|
{ENDPOINT_PATH} |
The endpoint path for repository APIs. | https://platform.adobe.io/data/core/xcore/ |
{CONTAINER_ID} |
The container where the decisions are located. | e0bd8463-0913-4ca1-bd84-6309134ca1f6 |
Request
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": {}
}'
Response
A successful response returns information on the newly created decision, including its unique id
. You can use id
in later steps to update or delete your decision.
{
"instanceId": "f88c9be0-1245-11eb-8622-b77b60702882",
"@id": "xcore:offer-activity:124b79dc3ce2d720",
"repo:etag": 1,
"repo:createdDate": "2023-10-19T20:02:09.694067Z",
"repo:lastModifiedDate": "2023-10-19T20:02:09.694067Z",
"repo:createdBy": "{CREATED_BY}",
"repo:lastModifiedBy": "{MODIFIED_BY}",
"repo:createdByClientId": "{CREATED_CLIENT_ID}",
"repo:lastModifiedByClientId": "{MODIFIED_CLIENT_ID}"
}