How to use REST with content items

You can use the Web Content Manager REST service to create, read, update, and delete content items.

For HCL Digital Experience 9.5 CF_173, CF18 and higher releases: You can use the Web Content Manager REST service to retrieve content or components with references to externally managed resources, using the Digital Asset Manager plugin. This option is also available to HCL Digital Experience 8.5 and 9.0 CF18 users.

Pre-requisite: Configure the Digital Asset Manager service plug-in. Go to Configuring the HCL Digital Experience Web Content Manager plug-in for more information.

Export DAM References API

This API supports retrieving content or components with references to externally managed resources using the Digital Asset Manager plugin. The results will expose a link to a WCM content item or component to the linked resource that is managed externally.

WCM content items or components managed in external resources can be retrieved using the following GET request formats:

Endpoint
GET request to Content:
http://host:port/wps/mycontenthandler/wcmrest/Content/<UUID of the content>
Sample URL:
http://localhost:10039/wps/mycontenthandler/wcmrest/Content/5331114d-e07e-4d10-9091-f037e0f0a42f
GET request to ImageComponent:
http://host:port/wps/mycontenthandler/wcmrest/LibraryImageComponent/<UUID of the component>
Sample URL:
http://localhost:10039/wps/mycontenthandler/wcmrest/LibraryImageComponent/5331114d-e07e-4d10-9091-f037e0f0a42f
GET request to FileComponent:
http://host:port/wps/mycontenthandler/wcmrest/LibraryFileComponent/<UUID of the component>
Sample URL:
http://localhost:10039/wps/mycontenthandler/wcmrest/LibraryFileComponent/5331114d-e07e-4d10-9091-f037e0f0a42f
Expected Body
The content Body can have the basic WCM structure or be empty:
<?xml version="1.0" encoding="UTF-8"?>
                    <feed xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="http://www.ibm.com/xmlns/wcm/8.0">
                    </feed>
Expected Headers
LTPA token of the user.
Return body
Note:
Sample for a content item that has a file and image element that are populated by linked Digital Asset Manager (external) references:
<?xml version="1.0" encoding="UTF-8"?><entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="http://www.ibm.com/xmlns/wcm/8.0">
    <id>wcmrest:5331114d-e07e-4d10-9091-f037e0f0a42f</id>
    <title xml:lang="en">content</title>
    <summary xml:lang="en"></summary>
    <wcm:name>content</wcm:name>
    <wcm:type>Content</wcm:type>
    <updated>2020-03-12T19:16:06.934Z</updated>
    <wcm:created>2020-03-12T19:16:06.934Z</wcm:created>
    <author>
        <wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</
    wcm:distinguishedName>
        <uri>/wps/mycontenthandler/!ut/p/digest!9GRUk0MKduqatA7U-8CVEQ/um/users/
    profiles/Z9eAeIHD63QC6N1P2MMS6J1C6JMG64JDEJM4CP9ECMMCCKHC83IHCK9P2JRKCN1</uri>
        <name>wpsadmin</name>
    </author>
    <wcm:owner>
        <wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/!ut/p/digest!9GRUk0MKduqatA7U-8CVEQ/um/users/
    profiles/Z9eAeIHD63QC6N1P2MMS6J1C6JMG64JDEJM4CP9ECMMCCKHC83IHCK9P2JRKCN1</uri>
        <name>wpsadmin</name>
    </wcm:owner>
    <wcm:lastModifier>
        <wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/!ut/p/digest!9GRUk0MKduqatA7U-8CVEQ/um/users/profiles/
    Z9eAeIHD63QC6N1P2MMS6J1C6JMG64JDEJM4CP9ECMMCCKHC83IHCK9P2JRKCN1</uri>
        <name>wpsadmin</name>
    </wcm:lastModifier>
    <wcm:creator>
        <wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/!ut/p/digest!9GRUk0MKduqatA7U-8CVEQ/um/users/
    profiles/Z9eAeIHD63QC6N1P2MMS6J1C6JMG64JDEJM4CP9ECMMCCKHC83IHCK9P2JRKCN1</uri>
        <name>wpsadmin</name>
    </wcm:creator>
    <wcm:profile/>
    <link rel="self" href="/wps/mycontenthandler/!ut/p/digest!9GRUk0MKduqatA7U-8CVEQ/
wcmrest/Content/5331114d-e07e-4d10-9091-f037e0f0a42f" xml:lang="en" label="Read"/>
    <link rel="edit" href="/wps/mycontenthandler/!ut/p/digest!9GRUk0MKduqatA7U-8CVEQ/
wcmrest/Content/5331114d-e07e-4d10-9091-f037e0f0a42f" xml:lang="en" label="Edit"/>
    <link rel="delete" href="/wps/mycontenthandler/!ut/p/digest!9GRUk0MKduqatA7U-8CVEQ/
wcmrest/Content/5331114d-e07e-4d10-9091-f037e0f0a42f" xml:lang="en" label="Delete"/>
    <link rel="create-draft" href="/wps/mycontenthandler/!ut/p/digest!
9GRUk0MKduqatA7U-8CVEQ/wcmrest/item/5331114d-e07e-4d10-9091-f037e0f0a42f/create-
draft" xml:lang="en" label="Create Draft"/>
    <link rel="change-to-draft" href="/wps/mycontenthandler/!ut/p/digest!
9GRUk0MKduqatA7U-8CVEQ/wcmrest/item/5331114d-e07e-4d10-9091-f037e0f0a42f/change-
to-draft" xml:lang="en" label="Change To Draft"/>
    <link rel="access-control" href="/wps/mycontenthandler/!ut/p/digest!
9GRUk0MKduqatA7U-8CVEQ/ac/
access:oid:Z6QReDeLPC6JO46H1D8MMKCGPDAMMG64BC0JM47G9E2JMOCGPCEJI166
3C26Q8663" xml:lang="en" label="Access Control"/>
    <link rel="library" href="/wps/mycontenthandler/!ut/p/digest!
9GRUk0MKduqatA7U-8CVEQ/wcmrest/Library/a2f8d947-0879-48ad-841f-e8c1c9df5bf1" 
xml:lang="en" label="Library"/>
    <link rel="parent" href="/wps/mycontenthandler/!ut/p/digest!9GRUk0MKduqatA7U-8CVEQ/
wcmrest/SiteArea/289526f2-351d-4a21-9d81-e354d6d73bf1" xml:lang="en" label="Parent"/>
    <link rel="versions" href="/wps/mycontenthandler/!ut/p/digest!
9GRUk0MKduqatA7U-8CVEQ/wcmrest/item/5331114d-e07e-4d10-9091-f037e0f0a42f/
versions" xml:lang="en" label="Versions"/>
    <link rel="preview" href="/wps/poc/!ut/p/digest!9GRUk0MKduqatA7U-8CVEQ/wcm/oid:
5331114d-e07e-4d10-9091-f037e0f0a42f" xml:lang="en" label="Preview"/>
    <link rel="edit-media" href="/wps/mycontenthandler/!ut/p/digest!
9GRUk0MKduqatA7U-8CVEQ/wcmrest/Content/5331114d-e07e-4d10-9091-f037e0f0a42f" 
type="application/vnd.ibm.wcm+xml" xml:lang="en" label="Edit Media"/>
    <link rel="content-template" href="/wps/mycontenthandler/!ut/p/digest!
9GRUk0MKduqatA7U-8CVEQ/wcmrest/ContentTemplate/5f04d8ba-90b5-43db-
a0c4-781dcfb999d4" xml:lang="en" label="Content Template"/>
    <link rel="elements" href="/wps/mycontenthandler/!ut/p/digest!
9GRUk0MKduqatA7U-8CVEQ/wcmrest/Content/5331114d-e07e-4d10-9091-f037e0f0a42f/
elements" xml:lang="en" label="Elements"/>
    <category scheme="wcmrest:workflowState" term="PUBLISHED" label="Published" xml:lang="en"/>
    <category scheme="wcmrest:favorite" term="false" xml:lang="en"/>
    <content type="application/vnd.ibm.wcm+xml">
        <wcm:content xmlns="http://www.ibm.com/xmlns/wcm/8.0">
            <elements xmlns:atom="http://www.w3.org/2005/Atom">
                <element name="image">
                    <title xml:lang="en">image</title>
                    <type>ImageComponent</type>
                    <data type="application/vnd.ibm.wcm+xml">
                        <image>
                            <dimension height="" width="" border="0"/>
                            <altText></altText>
                            <tagName></tagName>
                            <fileName>IMG_0001.jpg</fileName>
                            <resourceUri type="image/jpeg">http://ml-latest.team-q-dev.com:3001/dx/api/
                        media-library/v0/collections/faab3654-20dd-4c01-8936-c272b992e6f9/items/
                        c074e9c8-4e22-4ed0-a82a-3c593d9d9577?binary=true</resourceUri>
                        </image>
                    </data>
                 </element>
                 <element name="file">
                    <title xml:lang="en">file</title>
                    <type>FileComponent</type>
                    <data type="application/vnd.ibm.wcm+xml">
                        <resourceUri type="application/pdf">http://ml-latest.team-q-dev.com:3001/dx/
                    api/media-library/v0/collections/faab3654-20dd-4c01-8936-c272b992e6f9/items/
                    18f580ed-967c-4c9c-8f0a-dab76e8f2113?binary=true</resourceUri>
                    </data>
                 </element>
                 <element name="text">
                    <title xml:lang="en">text</title>
                    <type>RichTextComponent</type>
                    <data type="text/html"/>
                 </element>
             </elements>
         </wcm:content>
     </content>
 </entry>

Create

A content item can be created by sending a POST request to the following URI with an Atom entry used to represent the content item:
/Content
  • A library or parent link relation must be used to define the location of the hierarchical item that is being created.
  • An authoring template must be specified to set what authoring template to use when the item is created.
For example:
POST
HTTP/1.1 POST 
http://host:port/wps/mycontenthandler/wcmrest/Content/
Content-Type: application/atom+xml
		<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:wcm="wcm/namespace">
			<wcm:name>Content Name</wcm:name>
			<atom:title>Content Title</atom:title>
			<atom:link atom:rel="parent" atom:href="/wps/
            mycontenthandler/wcmrest/item/49f4ed95-a99f-434c-a415-77c341fa4893"/>
			<atom:link atom:rel="workflow" atom:href="/wps/
            mycontenthandler/wcmrest/item/abae799b-4cca-47ae-aad8-b3d8204deefb"/>
			<atom:link atom:rel="content-template" atom:href="/wps/
            mycontenthandler/wcmrest/item/588127d0-a4f8-44b5-87a4-5fe3f7bd3da7"/>
		</atom:entry>
Response:
201 Created

Create from a skeleton

A "skeleton" representation of a content item that is created from a content template can be obtained to aid in the creation of content items. This can be obtained by using a GET request to the following URI. When the skeleton is obtained and completed a POST request can be made by using this data to create the item.

/ContentTemplate/template-uuid/new-content
For example:
HTTP/1.1 GET http://host:port/wps/mycontenthandler/wcmrest/ContentTemplate/b7b8b3fb-8fa1-4eb3-915e-ce7514f7067f/new-content

Response 
200 OK

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="http://www.ibm.com/xmlns/wcm">
    <id>wcmrest:6bab48c6-1f24-454e-9bab-ae1be4cf3a0a</id>
    <title lang="en"></title>
    <summary lang="en"></summary>
    <wcm:name></wcm:name>
    <wcm:type>Content</wcm:type>
    <updated>2012-01-31T03:28:08.118Z</updated>
    <author>
        <wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</
    wcm:distinguishedName>
        <uri>/wps/mycontenthandler/!ut/p/digest!7K1PhYjxBw0jzCDqHCwg2w/um/
    users/profiles/Z9eAeHPCAJG963RD2MMG6P9O6MMG66BD6MM47IHP4MMS6M1DAJQ4C1BCAMID653</uri>
        <name>wpsadmin</name>
    </author>
    <wcm:owner>
        <wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/!ut/p/digest!7K1PhYjxBw0jzCDqHCwg2w/um/
    users/profiles/Z9eAeHPCAJG963RD2MMG6P9O6MMG66BD6MM47IHP4MMS6M1DAJQ4C1BCAMID653</uri>
        <name>wpsadmin</name>
    </wcm:owner>
    <link label="Library" rel="library" href="/wps/mycontenthandler/!ut/p/
digest!PQo5Yhy68oeppWcEz2sddA/wcmrest/item/a423287f-b0ce-4ee3-9c95-aa0939382228" lang="en"/>
    <link label="Content Template" rel="content-template" href="/wps/
mycontenthandler/!ut/p/digest!PQo5Yhy68oeppWcEz2sddA/wcmrest/Content/b7b8b3fb-8fa1-4eb3-915e-ce7514f7067f" lang="en"/>
    <content type="application/vnd.ibm.wcm+xml">
        <content xmlns="http://www.ibm.com/xmlns/wcm">
            <elements>
                <element name="Body">
                    <title lang="en">Body</title>
                    <type>RichTextComponent</type>
                    <data type="text/html"></data>
                </element>
            </elements>
        </content>
    </content>
</entry>

Update

A content item can be updated by sending a PUT request to the following URI with an Atom entry that specifies the fields on the item that need to be changed.
/Content/item-uuid
For example:
PUT
HTTP/1.1 PUT
http://host:port/wps/mycontenthandler/wcmrest/Content/abae799b-4cca-47ae-aad8-b3d8204deefb
Content-Type: application/atom+xml
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:wcm="wcm/namespace">
    <wcm:name>Updated Content Name</wcm:name>
    <atom:title>Updated Content Title</atom:title>
</atom:entry>
Response:
200 OK

Read

A content item can be read by sending a GET request to the following URI:
/Content/item-uuid
For example:
GET
HTTP/1.1 GET
http://host:port/wps/mycontenthandler/wcmrest/Content/fa2bfd32-7b2f-4394-a5ab-2e150c5ed8aa

<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:wcm="wcm/namespace">
    <atom:id>fa2bfd32-7b2f-4394-a5ab-2e150c5ed8aa</atom:id>
    <wcm:name>content name145805586</wcm:name>
    <atom:title>content title145805586</atom:title>
    <wcm:type>Content</wcm:type>
    <atom:updated>2011-04-27T04:06:32.643Z</atom:updated>
    <atom:link atom:rel="edit" atom:href="/wps/mycontenthandler/
wcmrest/Content/fa2bfd32-7b2f-4394-a5ab-2e150c5ed8aa"/>
    <atom:link atom:rel="library" atom:href="/wps/mycontenthandler/
wcmrest/item/957a67f2-9d70-469f-9d43-f63f78508e48"/>
    <atom:link atom:rel="parent" atom:href="/wps/mycontenthandler/
wcmrest/item/49f4ed95-a99f-434c-a415-77c341fa4893"/>
    <atom:link atom:rel="workflow-stage" atom:href="/wps/
mycontenthandler/wcmrest/item/f659d3af-7d45-4fc0-ad37-86e407caf2b6"/>
    <atom:link atom:rel="workflow" atom:href="/wps/mycontenthandler/
wcmrest/item/abae799b-4cca-47ae-aad8-b3d8204deefb"/>
    <atom:link atom:rel="versions" atom:href="/wps/mycontenthandler/
wcmrest/item/fa2bfd32-7b2f-4394-a5ab-2e150c5ed8aa/versions"/>
    <atom:link atom:rel="content-template" atom:href="/wps/mycontenthandler/
wcmrest/item/588127d0-a4f8-44b5-87a4-5fe3f7bd3da7"/>
    <atom:link atom:rel="elements" atom:href="/wps/mycontenthandler/
wcmrest/Content/fa2bfd32-7b2f-4394-a5ab-2e150c5ed8aa/elements"/>
</atom:entry>
Response:
200 OK

Delete

A content item can be deleted by sending a DELETE request to the following URI:
/Content/item-uuid
For example:
DELETE
HTTP/1.1 DELETE
http://host:port/wps/mycontenthandler/wcmrest/Content/fa2bfd32-7b2f-4394-a5ab-2e150c5ed8aa/
Response:
200 OK