JSON File Format for Content in an Enhanced CMS Workspace

Understand the content details from an export, then define your content details in JSON format for import. The export and import process works differently in enhanced CMS workspaces than it does in CMS workspaces. In enhanced CMS workspaces, each content item must have its own content.json file. Optionally, to specify the content key and folder placement of each content item, include a _meta.json file for each content.json.

Required Editions

Available in: Lightning Experience
Available in: Enterprise, Performance, Unlimited, and Developer Editions

Content Properties for content.json

The format of the content.json file depends on the content type—news, image, document, audio, video, or custom content. Each one has different properties. Enhanced CMS workspaces consider image, document, audio, and video content types as media, and those content types have similar content body properties.

All content.json files have these fields. You can omit optional fields from the JSON.

Field Name Type Description
contentBody contentBody

Required. The content body includes properties that define the body of the content record. Body properties differ by content type.

contentKey string

A unique identifier generated by Salesforce CMS. This field isn’t required for import, but if it’s omitted or left empty, a new content key is assigned to the content after import. If you include a content key that already exists in CMS, the imported content replaces the existing content in your workspace.

Content exported from Salesforce CMS includes this identifier.

title string Required. The title of the content record. This node is a name field (NAMEFIELD).
type string

Required. The content type:

  • sfdc_cms__image for images
  • sfcd_cms__document for documents
  • sfcd_cms__news for news
  • sfdc_cms__audio for audio
  • sfdc_cms__video for video
  • For custom content types, any value as defined by the user. For example, blog.

Media Content Body Properties

The sfdc_cms__image, sfdc_cms__document, sfdc_cms__audio, and sfdc_cms__video types have these content body (contentBody) properties.

Field Name Type Description
sfdc_cms:media source Required. A managed content media source node (MediaSource). Defines the properties of the source.
url string Optional. URL address of the image, document, audio, or video.

The source field represents a managed content media source node (MediaSource) within the sfdc_cms__image, sfdc_cms__document, sfdc_cms__audio, and sfdc_cms__video content types. A source field is required.

Field Name Type Description
mimeType string Optional. MIME type of the media source.
ref string Optional. Content key (contentKey) of the referenced content.
type string Required. Either file or the URL address of the image or document file. Valid URL bases are http:// or https://.

Here’s an example of the JSON structure for importing an image content record. Salesforce CMS assigns a content key to new content after import.

{
  "type" : "sfdc_cms__image",
  "title" : "Trailhead",
  "contentBody" : {
    "sfdc_cms:media" : {
      "source" : {
        "type" : "file",
        "mimeType" : "image/png"
      }
    }
  }
}

Here’s an example of the JSON structure for importing a document content record. Salesforce CMS assigns a content key to new content after import.

{
  "type" : "sfdc_cms__document",
  "title" : "Unveiling the Mysteries of Stars_ Exploring the Heart of the Cosmopolitans",
  "contentBody" : {
    "sfdc_cms:media" : {
      "source" : {
        "mimeType" : "application/pdf",
        "ref" : "0sNX200000007r7MAA",
        "type" : "file",
      },
      "url" : ""
    }
  }
}

sfdc_cms__news Content Body Properties

The sfdc_cms__news type has these content body (contentBody) properties.

Field Name Type Description
bannerImage bannerImage Optional. A managed content node (IMG) to display a graphic as a banner in the news item.
body string Required. A rich text node (RTE).
excerpt string Optional. Used to summarize the news piece. This node is a multi-line text (MTEXT).

The bannerImage field represents an image node (IMG) within the sfdc_cms__news content type.

Field Name Type Description
altText string Optional. Accessibility text to describe the content.
ref string Optional. Content key (contentKey) of an image. You must import the graphic for this reference in the enhanced CMS workspace before you import the news content record.
type string The type of reference. For images, the value is imageReference.
url string The path to the source graphic.

Here’s an example of the JSON structure for a news item that references an image by using the image’s content key.

{
  "type" : "sfdc_cms__news",
  "title" : "Astronomers Unveil New Stellar Marvel: The Lumina Nova",
  "contentBody" : {
    "bannerImage" : {
      "altText" : "Blue sky with many stars.",
            "source" : {
        "ref" : {
          "contentKey" : "MCDB6GUACSNNGTZAEAI5PGSHA7UY"
        },
        "type" : "imageReference"
      },
      "url" : "/cms/media/MCDB6GUACSNNGTZAEAI5PGSHA7UY"
    },
    "body" : "<div><em>By Xena Bobina, Contributing Writer</em></div><div><br /></div><div>In a groundbreaking discovery that promises to reshape our understanding of the cosmos, astronomers have announced the identification of a previously unknown star, dubbed Lumina Nova.</div><div>Located in the distant reaches of the Milky Way galaxy, Lumina Nova shines with a brilliance unmatched by any other stellar object in its vicinity. Its luminosity far surpasses that of our own Sun, captivating scientists with its dazzling display.</div><div>Dr. Jonathan Reyes, lead astronomer on the research team, described the moment of discovery as nothing short of extraordinary. ,
    "excerpt" : "It's a thrilling opportunity to deepen our understanding of the universe."
  }
}

Custom Content Body Properties

Your content needs a name, but the rest of the content type properties are up to you. You can set any nodes depending on the type of content that you want to import. Here are some example properties.

Note
Note For custom content type, all optional fields can be defined as required.
Example Field Name Type Description
dateNode string Optional. Date node (DATE). Valid format is yyyy-MM-dd.
dateTimeNode dateTimeNode Optional. Datetime node (DATETIME). Defines the body of the date, time, and time zone of the content.
nameNode string Required. The name field node (NAMEFIELD) is a free text field.
urlNode string Optional. URL address of the content.

The dateTimeNode field represents a managed content date and time node (DateTime) within the custom content type.

Field Name Type Description
dateTimeValue string Optional. Valid format is yyyy-MM-dd'T'HH:mm:ss.SSS'Z' (UTC datetime in ISO 8601 format). Valid format for the date is YYYY-MM-DD. Valid format for the time is 24-hour style.
timeZone string Optional. Valid format is Country/City.

Here’s an example of the JSON structure for importing a custom content item. Salesforce CMS assigns a content key after import.

{
    "content": [{
        "type": "customContentType",
        "body": {
            "nameNode": "CustomContentImportTest",
            "urlNode": "http://www.exampletube.com/myVideo",
            "dateNode": "1994-07-01",
            "dateTimeNode": {
                "dateTimeValue": "2008-09-15T15:53:00.000Z",
                "timeZone": "America/Los_Angeles"
            }
        }
    }]
}

Content Properties for _meta.json

The _meta.json file is optional, depending on whether the content is existing or new. If the _meta.json file isn’t included in the .zip archive for import, the content defined in the content.json file is assigned a new content key and put in the workspace root folder.

Field Name Type Description
contentKey string Optional. The content key of the content item.
path string Optional. This field isn’t required for import, but if it’s omitted or left empty, the content imports to the root level of the workspace. When importing content in folders, use this field to specify the location of a content item within folders.
taxonomyTerms array Optional. This field contains developer names of the taxonomy terms applied as tags to the content item. To import content with taxonomy terms, make sure that your org has a content taxonomy that includes the terms and that you have the View Content Taxonomy permission enabled.

Here’s an example of the JSON structure for importing a content item with taxonomy tags and specifying which enhanced CMS workspace folder that you want the content to import into.

{
  "contentKey" : "MCLYY5A5UXOBH6RHTICCNTAKEXR4",
  "path" : "",
  "taxonomyTerms" : ["Term 1", "Term 2"]
}
Note
Note Sometimes, the JSON file might start with a hidden character called a byte order mark. This character is not visible in all text editors and it can cause the import to fail with a file read error. To fix this, save the file using a text editor that lets you choose the encoding UTF-8.