Create a collection

Last update: 2024-03-13
  • Created for:
  • Experienced
    Developer

Collections are subsets of offers based on predefined conditions defined by a marketer, such as category of the offer.

You can create a collection by making a POST request to the Offer Library API, while providing your container ID.

Accept and Content-Type headers

The following table shows the valid values which comprise the Content-Type and Accept fields in the request header:

Header name Value
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-filter;version=0.1"

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 collections 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-filter;version=0.1"' \
  -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 '{
        "xdm:name": "Offer Collection 1",
        "xdm:filterType": "anyTags",
        "xdm:ids": [
            "xcore:tag:124e147572cd7866"
        ]
    }'

Response

A successful response returns information on the newly created collection, including its unique instance ID and placement @id. You can use the instance ID in later steps to update or delete your collection. You can use your unique collection @id in a later tutorial to create a decision.

{
   "@id": "xcore:offer-filter:124e3594ce8b4930",
    "repo:etag": 1,
    "repo:createdDate": "2023-10-21T22:59:17.345797Z",
    "repo:lastModifiedDate": "2023-10-21T22:59:17.345797Z",
    "repo:createdBy": "{CREATED_BY}",
    "repo:lastModifiedBy": "{MODIFIED_BY}",
    "repo:createdByClientId": "{CREATED_CLIENT_ID}",
    "repo:lastModifiedByClientId": "{MODIFIED_CLIENT_ID}"
}

On this page