Create and Manage Landing Pages in Marketing Cloud Next

Use the content management system (CMS) Contents endpoints in Connect REST API to create and manage landing page content in a marketing content workspace. A landing page stores its content in one of two ways: as raw HTML or as a structure of content blocks.

Prerequisites 

  • To create a landing page, get the ID of the content workspace where you want to create it. Pass this ID as the contentSpaceOrFolderId field. See Manage Content Workspaces.
  • To delete a landing page that’s part of a publication schedule, cancel the schedule first.

Create a Landing Page with HTML 

To author a landing page as raw HTML, send a POST request and include your markup in the rawHtml field. The HTML supports Handlebars expressions.

1POST /services/data/{apiVersion}/connect/cms/contents

This table lists the properties in the request body.

FieldData TypeDescription
contentSpaceOrFolderIdstringRequired. The ID of the workspace or folder that contains the landing page.
contentTypestringRequired. The content type. For a landing page, use sfdc_cms__landingPage.
titlestringRequired. The name of the landing page in the workspace.
urlNamestringRequired. The URL segment for the page’s address.
contentBodyobjectRequired. The page content. The next rows describe its fields.
contentBody.sfdc_cms:titlestringRequired. The page title.
contentBody.sfdc_cms:seoProperties.titlestringRequired. The public page title that search engines use.
contentBody.rawHtmlstringRequired. The page’s HTML content. This field designates the page as an HTML landing page.
contentBody.sfdc_cms:blockobjectRequired. The root content block.

This sample request shows how to create an HTML landing page.

Request Example
1{
2  "contentSpaceOrFolderId": "0ZuEXAMPLE00000000",
3  "contentType": "sfdc_cms__landingPage",
4  "title": "Spring Product Launch",
5  "urlName": "spring-product-launch",
6  "contentBody": {
7    "sfdc_cms:title": "Spring Product Launch",
8    "sfdc_cms:seoProperties": {
9      "title": "Spring Product Launch"
10    },
11    "rawHtml": "<!DOCTYPE html><html><head><title>Spring Product Launch</title></head><body><h1>Spring Product Launch</h1><p>Shop the new collection.</p></body></html>",
12    "sfdc_cms:block": {
13      "type": "block",
14      "definition": "sfdc_cms/rootContentBlock",
15      "children": []
16    }
17  }
18}

In the request, replace WORKSPACE_ID with the ID of your content workspace.

Here’s a sample response:

Response Example
1{
2  "contentKey": "MC0EXAMPLEKEY0000000000000",
3  "contentType": {
4    "fullyQualifiedName": "sfdc_cms__landingPage"
5  },
6  "contentSpace": {
7    "id": "WORKSPACE_ID"
8  },
9  "managedContentId": "20YEXAMPLE00000000",
10  "managedContentVariantId": "9PsEXAMPLE00000000",
11  "isPublished": false,
12  "status": {
13    "label": "Draft",
14    "status": "Draft"
15  },
16  "title": "Spring Product Launch"
17}

The request creates the landing page in Draft status. Copy the managedContentId field value to update or publish the page later.

The response returns the rawHtml value with HTML-escaped characters (for example, &lt;div&gt;).

Note

Create a Landing Page with Components 

To build a landing page from content blocks, provide a block structure in sfdc_cms:block and omit rawHtml. Each block has a definition and can hold child blocks in children.

1POST /services/data/{apiVersion}/connect/cms/contents

This table lists the properties of each block in sfdc_cms:block.

FieldTypeDescription
typestringRequired. The element type. Use block.
definitionstringRequired. The block type, such as lightning/section. For the block types that a landing page uses, see the next table.
attributesobjectThe block’s settings. Required attributes depend on the block type. For example, lightning/column requires columnWidth.
childrenarrayAn array of child blocks. The block type determines which child blocks are allowed and how many.
idstringA unique ID for the block. If you omit it, an ID is generated.

Blocks follow a fixed hierarchy. The root block contains sections, each section contains columns, and each column contains content blocks.

BlockRequired AttributesContains
sfdc_cms/rootContentBlockNoneSections (lightning/section).
lightning/sectionNone1–12 columns (lightning/column). A section must contain at least one column.
lightning/columncolumnWidth, from 1 through 12Content blocks, such as lightning/heading, lightning/paragraph, lightning/image, lightning/button, and lightning/form. For each block’s attributes, see Content Component Blocks.

This sample request shows how to create a landing page from content blocks.

Request Example
1{
2  "contentSpaceOrFolderId": "0ZuEXAMPLE00000000",
3  "contentType": "sfdc_cms__landingPage",
4  "title": "Spring Product Launch",
5  "urlName": "spring-product-launch",
6  "contentBody": {
7    "sfdc_cms:title": "Spring Product Launch",
8    "sfdc_cms:seoProperties": {
9      "title": "Spring Product Launch"
10    },
11    "sfdc_cms:block": {
12      "type": "block",
13      "definition": "sfdc_cms/rootContentBlock",
14      "children": [
15        {
16          "type": "block",
17          "definition": "lightning/section",
18          "children": []
19        }
20      ]
21    }
22  }
23}

Retrieve a Landing Page 

To get the details of a landing page, send a GET request with its contentKey. The contentKey is the unique ID or API name of the landing page.

1GET /services/data/{apiVersion}/connect/cms/contents/{contentKey}

The response includes the contentBody, contentType, status, and identifiers, such as managedContentId and managedContentVariantId.

This sample request shows how to retrieve a landing page.

Request Example
1GET /services/data/{apiVersion}/connect/cms/contents/MC0EXAMPLEKEY0000000000000

Here’s a sample response:

Response Example
1{
2  "apiName": "MC0EXAMPLEKEY0000000000000",
3  "contentBody": {
4    "rawHtml": "&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;head&gt;&lt;title&gt;Spring Product Launch&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;Spring Product Launch&lt;/h1&gt;&lt;p&gt;Shop the new collection.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;",
5    "sfdc_cms:block": {
6      "definition": "sfdc_cms/rootContentBlock",
7      "type": "block",
8      "children": []
9    },
10    "sfdc_cms:seoProperties": {
11      "title": "Spring Product Launch"
12    },
13    "sfdc_cms:title": "Spring Product Launch"
14  },
15  "contentKey": "MC0EXAMPLEKEY0000000000000",
16  "contentSpace": {
17    "id": "0ZuEXAMPLE00000000"
18  },
19  "contentType": {
20    "fullyQualifiedName": "sfdc_cms__landingPage",
21    "name": "Landing Page"
22  },
23  "isPublished": false,
24  "language": "en_US",
25  "managedContentId": "20YEXAMPLE00000000",
26  "managedContentVariantId": "9PsEXAMPLE00000000",
27  "managedContentVersionId": "5OUEXAMPLE00000000",
28  "status": {
29    "label": "Draft",
30    "status": "Draft"
31  },
32  "title": "Spring Product Launch",
33  "urlName": "spring-product-launch"
34}

Update a Landing Page 

To update a landing page, first retrieve the landing page to get the managedContentVariantId. Then, send a PUT request and wrap the content in the contentBody field.

1PUT /services/data/{apiVersion}/connect/cms/contents/variants/{variantId}

Include the complete contentBody in the request. If the request omits properties, the values of those properties are cleared. The status of the page doesn’t change. The response returns the updated landing page.

This sample request shows how to update a landing page.

Request Example
1{
2  "contentBody": {
3    "sfdc_cms:title": "Spring Product Launch",
4    "sfdc_cms:seoProperties": {
5      "title": "Spring Product Launch"
6    },
7    "rawHtml": "<!DOCTYPE html><html><body><h1>Spring Product Launch</h1><p>Now with free shipping.</p></body></html>",
8    "sfdc_cms:block": {
9      "type": "block",
10      "definition": "sfdc_cms/rootContentBlock",
11      "children": []
12    }
13  }
14}

Clone a Landing Page 

To copy a landing page, send a POST request with its contentKey and an empty request body.

1POST /services/data/{apiVersion}/connect/cms/contents/{contentKey}/clone

The copy is created in Draft status with the same body fields. The response returns the copy’s contentKey and managedContentId. To update or delete the copy, you need its managedContentVariantId. To get it, retrieve the copy.

Delete a Landing Page 

To delete a landing page, first retrieve the landing page to get the managedContentVariantId. Then, send a DELETE request.

1DELETE /services/data/{apiVersion}/connect/cms/contents/variants/{variantId}

This sample request shows how to delete a landing page.

Request Example
1DELETE /services/data/v69.0/connect/cms/contents/variants/9PsXXXXXXXXXXXXXXX

A successful request returns 204 No Content.

Deleting a landing page is permanent.

Warning

Publish a Landing Page 

To make a landing page accessible to visitors, publish it. Publishing makes the page available on the marketing site at its URL.

1POST /services/data/{apiVersion}/connect/cms/contents/publish

In the request body, provide the managedContentId (or the managedContentVariantId) in the contentIds field. Specify the content ID, not the content key.

Request Example
1{
2  "contentIds": ["MANAGED_CONTENT_ID"]
3}

The publishing process is asynchronous. The response returns a staged deployment. To list the channels in your workspace, send a GET request to /services/data/{apiVersion}/connect/cms/channels. For more about publishing, see Publish Content Items.

See Also