When you create a content item to your content workspace, you can’t use it in messages until you publish it.
Publish a Piece of Content
To publish content, issue a POST request to the /services/data/{apiVersion}/connect/cms/contents/publish endpoint. The body of the request must contain an array called contentIds. Each item in the array is the content ID (managedContentId) of a content item that you want to publish.
POST /services/data/{apiVersion}/connect/cms/contents/publish HTTP/1.1
Host: {subdomain}.my.salesforce.com
Content-Type: application/json
Authorization: Bearer YOUR_BEARER_TOKEN
{
"description": "Content for new email campaign",
"contentIds": ["20Y1Q0000000XXyUAM"]
}
If the request is successful, the response includes a publish date and deployment ID.
{
"deploymentId": "0jk1Q000000xXTgQAM",
"description": "Content for new email campaign",
"publishDate": "2024-01-22T21:38:53.000Z"
}
Unpublish Content
To revert a published content item back to draft status, issue a POST request to the /services/data/{apiVersion}/connect/cms/contents/unpublish endpoint.
POST /services/data/{apiVersion}/connect/cms/contents/unpublish HTTP/1.1
Host: {subdomain}.my.salesforce.com
Content-Type: application/json
Authorization: Bearer YOUR_BEARER_TOKEN
{
"description": "Unpublish an email via the API",
"contentIds": ["20YQZ0000007G3F2AU"]
}
You can unpublish content that has a status of Published. Unpublishing removes the content from active use. The content item itself isn’t deleted, and you can republish it later.
See Also
- Create and Manage Emails in Marketing Cloud
- API Reference: Publish CMS Content
- API Reference: Unpublish CMS Content