Retrieve CMS Content with a Connected App
Use the Connect REST API’s CMS delivery query resource to get CMS content with a connected app. If the request is successful, the response contains a JSON object with the selected content.
To form the API request, you need these items.
- A CMS access token
- A CMS channel ID that has access to the content
To send an API call to retrieve CMS content, make an HTTP GET request to the /services/data/v{XX.X}/connect/cms/delivery/channels/{channelId}/contents/query
resource. Append the managedContentType
request parameter, and set its value to the CMS content type.
For example, this sample URL selects content with the content type named “Promotion” from the channel with an ID of 0ap5w000000kcaiAAA
.
Include an Authorization header with the value Bearer {access_token}
, where access_token is your CMS access token. Optionally, specify the response format with a Content-Type header.
This Node.js sample requests CMS content from the channel ID stored in the config.channelId
variable, of the content type from the variable type
.
In response to the API request, the API returns an HTTP response code and a JSON body with an object containing all the selected content and pagination details.
This sample shows the response body from the previous sample request to retrieve content.