+

Search Tips   |   Advanced Search

Use REST with Web Content Manager items

This topic provides an overview of the options available when working with Web Content Manager items, including the types of items that can be created and updated, and other important information related to the process of creating and updating web content items using REST.


Item types

The following item types can be created, read, updated and deleted using the Web Content Manager REST service:

The following element types can also be created, read, updated and deleted in site areas and content items using the Web Content Manager REST service:


Content representations

Atom entry documents

Each web content item has an associated atom entry document. The entry document provides access to the common metadata properties of the item, such as title and description, along with links to related items, and access control information.

The default media type of an entry document is application/atom+xml, however application/json representations can also be obtained. Entry documents can be retrieved by executing an HTTP GET to the entry resource. Entry resource URIs can be obtained from:

  • the service document

  • links in other entry documents

  • links in feed documents

  • using POC to resolve an ID

Example links to entry documents:

<link rel="edit" href="/wps/mycontenthandler/!ut/p/wcmrest/SiteArea/c6b00ee6-d628-4cbd-9e65-15c90f2093a6"/>
<link rel="parent" href="/wps/mycontenthandler/!ut/p/wcmrest/item/ae6a3632-a1b5-456a-866e-e9baab84fe29"/>
<link rel="library" href="/wps/mycontenthandler/!ut/p/wcmrest/item/54a68ca2-c550-4385-966f-b0b612147547"/>

Media resources

In addition to the entry document, most items will also have a media resource associated with them. The media resource exists to store the content of the item, for example, HTML or an image. The media resource location is found in the edit-media link of an items entry document. Media resource URLs support HTTP GET and PUT.
<link rel="edit-media" type="text/html" 
href="/wps/mycontenthandler/!ut/p/wcmrest/PresentationTemplate/02da6e9d-20ca-4c54-ae4a-f1114fa8e948"/>


Content Negotiation

When a resource supports multiple representations with different content types, clients can use content negotiation to request a specific representation. For example, entry documents are available in application/atom+xml; type=entry and application/json. There are two ways a client can specify the media type that the client can accept:

HTTP Accept header

Accept: application/atom+xml

Request parameter mime-type

GET /wps/mycontenthandler/!ut/p/wcmrest/SiteArea/c6b00ee6-d628-4cbd-9e65-15c90f2093a6?mime-type=application%2Fjson HTTP/1.0


Example entry

This is an example in application/atom+xml format:

<entry xmlns="http://www.w3.org/2005/Atom" xmlns:wcm="namespace">
    <id>3aabfe14-cc9e-4eb5-ad06-d4fc8fd2f1df</id>
    <title>SampleHTMLComponent</title>
    <link rel="edit" href="/wps/mycontenthandler/!ut/p/wcmrest/LibraryHTMLComponent/3aabfe14-cc9e-4eb5-ad06-d4fc8fd2f1df"/>
    <link rel="edit-media" type="text/html" href="/wps/mycontenthandler/!ut/p/wcmrest/LibraryHTMLComponent/3aabfe14-cc9e-4eb5-ad06-d4fc8fd2f1df"/>
    <link rel="library" href="/wps/mycontenthandler/!ut/p/wcmrest/item/c98d11e1-7f2a-480e-9aac-40eb1949cbda"/>
    <link rel="create-draft" href="/wps/mycontenthandler/!ut/p/wcmrest/item/3aabfe14-cc9e-4eb5-ad06-d4fc8fd2f1df/create-draft"/>
    <link rel="change-to-draft" href="/wps/mycontenthandler/!ut/p/wcmrest/item/3aabfe14-cc9e-4eb5-ad06-d4fc8fd2f1df/change-to-draft"/>
    <link rel="versions" href="/wps/mycontenthandler/!ut/p/wcmrest/item/3aabfe14-cc9e-4eb5-ad06-d4fc8fd2f1df/versions"/>
    <link rel="add-attachment" href="/wps/mycontenthandler/!ut/p/wcmrest/LibraryHTMLComponent/3aabfe14-cc9e-4eb5-ad06-d4fc8fd2f1df/attachments"/>
    <updated>2011-05-30T02:05:44.574Z</updated>
    <author>
        <wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/!ut/p/digest!wtpqWRz_9ePiiVHk1Rw2cw/um/users/profiles/Z9eAeH1C2JG561RC6JM47H9E4MMG6PHO6JM4C5JD0JMOC6BEEJS464JDG3I56K1</uri>
        <name>wpsadmin</name>
    </author>
    <wcm:owner>
        <wcm:distinguishedName>uid=wpsadmin,o=defaultWIMFileBasedRealm</wcm:distinguishedName>
        <uri>/wps/mycontenthandler/!ut/p/digest!wtpqWRz_9ePiiVHk1Rw2cw/um/users/profiles/Z9eAeH1C2JG561RC6JM47H9E4MMG6PHO6JM4C5JD0JMOC6BEEJS464JDG3I56K1</uri>
        <name>wpsadmin</name>
    </wcm:owner>
    <wcm:name>SampleHTMLComponent</wcm:name>
    <wcm:type>LibraryHTMLComponent</wcm:type>
    <wcm:state>PUBLISHED</wcm:state>
   </entry>


Parent: Work with web content items using REST