+

Search Tips   |   Advanced Search

Use REST with drafts and workflows

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.


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="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

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

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

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

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

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

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 


Workflow Comments

To ensure that comments are added to workflow stages that require comments, a GET request must be issued to the associated link. This will return an HTML form indicating whether a comment is required.

To add the comment you either submit the form, or perform an HTTP Post request with a content type of text/plain. For example:

    HTTP GET /wps/mycontenthandler/wcmrest/item/84e35979-d7c4-429a-b2ab-eb79abc5debc/next-stage Accept: text/html <html> <b>Next Stage</b><br><br> <form action="/wps/mycontenthandler/!ut/p/digest!hp5aUN2TU2D-7ziKYRo2-g/wcmrest/item/84e35979-d7c4-429a-b2ab-eb79abc5debc/next-stage" enctype="multipart/form-data" method="POST"> <label for="comment"><b>*</b>Enter Comment</label> <input name="comment" type="text" required/><br> <input type="submit" value="Submit"></input> </form> </html>


Parent Work with web content items using REST