The Content Delivery 2 API is used to retrieve content items and slots from Dynamic Content in JSON format. The API is optimized for speed, and for flexibility, allowing you to retrieve content by id as well as key, and choose the format of the response. These features make it easier for you to deliver your content to websites, apps, ecommerce systems, voice driven devices and many other types of applications.
The main features of Content Delivery 2 are:
Retrieve content by id or delivery key. Keys are arbitrary strings of up to 150 characters that can be associated with slots and content items. A delivery key can be used instead of the content id to retrieve content.
Specify the format of the response. You can retrieve content in a bandwidth optimised linked data format or inlined in a content tree. For linked content, such as a carousel or grid that contains links to other content, you have three options for the depth of content to be retrieved. You can choose to retrieve the root item, all linked items or you can set the depth to between 0 and 22, to retrieve a partial dependency tree.
List, sort and filter content. You can list content by content type schema, specify a sort order and filter by one or more user defined properties and values.
You can find more information about Content Delivery 2 and examples on our documentation site.
A delivery key can be a simple string or a path such as "home-page/feature-banner". This makes it simpler to write your integration code and allows users more control over where items of content are delivered. You can add a delivery key to a slot in the Dynamic Content app or to a content item or slot using the Dynamic Content Management API.
Note that a delivery key may not start or end with "/" and must be between 1 and 150 characters. Delivery keys can contain the following alphanumeric characters: a to z, A to Z and 0 to 9. You can also include "-" and "_" and "/" as long as it is not included at the start or end of the key.
- Content Delivery 2 must be provisioned on your hub before you can use the API.
- Content published from hubs that have Content Delivery 2 enabled will be accessible from both the Content Delivery API and the Content Delivery 2 API.
- The current version of the Dynamic Content Salesforce Commerce Cloud integration does not use Content Delivery 2 and so cannot make use of features such as delivery keys.
Get multiple content items by id and/or key
Retrieves multiple content item by their id or delivery key
header Parameters
Host required | string Example: anya-finn.cdn.content.amplience.net The hostname containing the hub name |
Request Body schema: */*
Request body for retrieving multiple content items by id and/or delivery key
object (Parameters) | |
required | Array of ItemRequestById (object) or ItemRequestByKey (object) |
Responses
Request samples
- Payload
{ "requests": [ { "id": "5d69bdef-df0b-4680-acfc-0bdaa2a82bed" }, { "key": "women/outdoors" } ] }
Response samples
- 200
{ "responses": [ { "content": { "_meta": { "name": "home-page-feature-slot", "schema": "http://docexample.com/tutorialbannerslot.json", "deliveryKey": "promo-page/main-feature-slot", "edition": { "id": "5ddeb27d4cedfd0001c66dee", "start": "2019-11-27T17:53:00.000Z", "end": "2019-11-30T23:59:59.999Z" }, "deliveryId": "5d69bdef-df0b-4680-acfc-0bdaa2a82bed" }, "bannerslot": { "_meta": { "schema": "http://bigcontent.io/cms/schema/v1/core#/definitions/content-link", "locked": false, "rootContentItemId": "d4744c2c-3dff-49b7-97c8-3ef16d693c30" }, "contentType": "http://docexample.com/tutorialbanner.json", "id": "d4744c2c-3dff-49b7-97c8-3ef16d693c30" }, "linkedContent": [ { "_meta": { "name": "wear-a-hat", "schema": "http://docexample.com/tutorialbanner.json", "deliveryId": "d4744c2c-3dff-49b7-97c8-3ef16d693c30" } }, { "background": { "_meta": { "schema": "http://bigcontent.io/cms/schema/v1/core#/definitions/image-link" }, "id": "7facf6f8-fea8-4f19-ac65-d9535ba1bf38", "name": "white-winter-hat", "endpoint": "ampproduct", "defaultHost": "classic.cdn.media.amplience.net" }, "headline": "Winter is here", "strapline": "Stay inside or wear a hat." } ] } } ] }
Filter content items
List, sort and filter content items. Items are filtered by paths and values.
header Parameters
Host required | string Example: anya-finn.cdn.content.amplience.net The hostname containing the hub name |
Request Body schema: */*
Request body for querying for content
required | Array of objects (FilterObject) A maximum of 6 paths may be specified |
object (SortingPair) | |
object | |
object (Parameters) |
Responses
Request samples
- Payload
{ "filterBy": [ { "path": "/_meta/schema", "value": "https://schema-examples.com/blogpost-filter-and-sort" } ] }
Response samples
- 200
- 400
{ "responses": [ { "content": { "_meta": { "deliveryId": "11111111-ceb5-40e2-b8dc-ae09aea50c60" } } }, { "content": { "_meta": { "deliveryId": "22222222-7c82-4d40-9854-e52fc1f978eb" } } } ], "page": { "responseCount": 2, "nextCursor": "eyJzb3J0S2V5IjoiMjIyMjIyMjItN2M4Mi00ZDQwLTk4NTQtZTUyZmMxZjk3OGViIiwiaXRlbUlkIjoibXl0ZXN0aHViOjIyMjIyMjIyLTdjODItNGQ0MC05ODU0LWU1MmZjMWY5NzhlYiJ9" } }
Get a Content Item by id
Retrieves a Content Item by its id
path Parameters
id required | string content item UUID |
query Parameters
depth | string One of:
|
format | string One of:
|
locale | string
|
header Parameters
Host required | string Example: anya-finn.cdn.content.amplience.net The hostname containing the hub name |
Responses
Response samples
- 200
- 404
{ "content": { "_meta": { "name": "Hats carousel", "schema": "https://example.com/carousel", "deliveryId": "bd89c2ed-0ed5-4304-8c89-c0710af500e2" }, "slides": [ { "_meta": { "schema": "http://bigcontent.io/cms/schema/v1/core#/definitions/content-link" }, "contentType": "https://example.com/carousel-slide", "id": "7823de65-2e67-450c-a5db-d8c9b616801b" }, { "_meta": { "schema": "http://bigcontent.io/cms/schema/v1/core#/definitions/content-link" }, "contentType": "https://example.com/carousel-slide", "id": "28c75b57-2c66-4b24-9059-ddc2b05a44d4" }, { "_meta": { "schema": "http://bigcontent.io/cms/schema/v1/core#/definitions/content-link" }, "contentType": "https://example.com/carousel-slide", "id": "f2f989b5-4a06-4a9b-9fb0-36ea3b3cae78" }, { "_meta": { "schema": "http://bigcontent.io/cms/schema/v1/core#/definitions/content-link" }, "contentType": "https://example.com/carousel-slide", "id": "efe831c2-c5b9-4cde-9c08-0f946968ab47" } ] } }
Get a Content Item by delivery key
Retrieves a Content Item by its delivery key
query Parameters
depth | string One of:
|
format | string One of:
|
locale | string
|
header Parameters
Host required | string Example: anya-finn.cdn.content.amplience.net The hostname containing the hub name |
Responses
Response samples
- 200
- 404
{ "content": { "_meta": { "name": "Hats carousel", "schema": "https://example.com/carousel", "deliveryId": "bd89c2ed-0ed5-4304-8c89-c0710af500e2" }, "slides": [ { "_meta": { "schema": "http://bigcontent.io/cms/schema/v1/core#/definitions/content-link" }, "contentType": "https://example.com/carousel-slide", "id": "7823de65-2e67-450c-a5db-d8c9b616801b" }, { "_meta": { "schema": "http://bigcontent.io/cms/schema/v1/core#/definitions/content-link" }, "contentType": "https://example.com/carousel-slide", "id": "28c75b57-2c66-4b24-9059-ddc2b05a44d4" }, { "_meta": { "schema": "http://bigcontent.io/cms/schema/v1/core#/definitions/content-link" }, "contentType": "https://example.com/carousel-slide", "id": "f2f989b5-4a06-4a9b-9fb0-36ea3b3cae78" }, { "_meta": { "schema": "http://bigcontent.io/cms/schema/v1/core#/definitions/content-link" }, "contentType": "https://example.com/carousel-slide", "id": "efe831c2-c5b9-4cde-9c08-0f946968ab47" } ] } }