+

Search Tips   |   Advanced Search

Use REST with drafts and workflows

We can use the REST services for Web Content Manager to create drafts, approve items in a workflow, and move items through different stages of a workflow.

The workflow features of the REST services for Web Content Manager can be used with the following item types:

Item type API type
Text component LibraryTextComponent
Short text component LibraryShortTextComponent
Rich text component LibraryRichTextComponent
HTML Component LibraryHTMLComponent
Number component LibraryNumericComponent
Date and time component LibraryDateComponent
Image component LibraryImageComponent
File resource component LibraryFileComponent
Content item Content
Site Area SiteArea
Managed Page PortalPage


Creating a draft of an item that does not use a workflow

We can create a draft of items that do not use workflows.

To do that, specify explicitly the draft workflow state in the request entry data. For example, to create a link component as draft:

HTTP/1.1 POST

http://host:port/wps/mycontenthandler/wcmrest/LibraryLinkComponent

<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:wcm="namespace">

    <wcm:name>linkDraft_E</wcm:name>

    <atom:link atom:rel="library" atom:href="/wps/mycontenthandler/!ut/p/wcmrest/item/d07f0a12-3801-465e-bc20-eaec2cecf5cb"/>

    <category label="Draft" scheme="wcmrest:workflowState" term="DRAFT"/>

</atom:entry>

201 Created


Create a draft in a workflow

We can use the REST service to create a new draft item. This is equivalent to using the Create Draft button in the authoring portlet.

A new draft of an item can be created by sending a POST request to the following URI:

/item/item-uuid/create-draft
For example:
HTTP/1.1 POST
http://host:port/wps/mycontenthandler/wcmrest/item/item-uuid/create-draft

201 Created


Move an item to the next stage

We can use the REST service to move an item to the next stage of a workflow. This is equivalent to using the Next Stage button in the authoring portlet.

An item can be moved to the next stage by sending a POST request to the following URI:

/item/item-uuid/next-stage
For example:
HTTP/1.1 POST
http://host:port/wps/mycontenthandler/wcmrest/item/<item-uuid>/next-stage

201 Created


Move an item to the previous stage

We can use the REST service to move an item to the previous stage of a workflow. This is equivalent to using the Previous Stage button in the authoring portlet.

An item can be moved to the previous stage by sending a POST request to the following URI:

/item/item-uuid/previous-stage
For example:
HTTP/1.1 POST
http://host:port/wps/mycontenthandler/wcmrest/item/item-uuid/previous-stage

201 Created


Approving an item within a workflow

We can use the REST service to move an item to the next stage of a workflow by approving it. This is equivalent to using the Approve button in the authoring portlet.

An item can be approved by sending a POST request to the following URI:

/item/item-uuid/approve
For example:
HTTP/1.1 POST
http://host:port/wps/mycontenthandler/wcmrest/item/item-uuid/approve

201 Created


Rejecting an item within a workflow

We can use the REST service to reject an item in a workflow. This is equivalent to using the Reject button in the authoring portlet.

An item can be rejected by sending a POST request to the following URI:

/item/item-uuid/reject
For example:
HTTP/1.1 POST
http://host:port/wps/mycontenthandler/wcmrest/item/item-uuid/reject

201 Created


Restarting a workflow

We can use the REST service to restart a workflow. This is equivalent to using the Restart button in the authoring portlet.

An item can be restarted by sending a POST request to the following URI:

/item/item-uuid/restart
For example:
HTTP/1.1 POST
http://host:port/wps/mycontenthandler/wcmrest/item/item-uuid/restart

201 Created


Parent: Work with web content items using REST