WorkflowΒΆ

Note

Currently the workflow support is limited to executing transitions on content.

In Plone, content almost always has a workflow attached. We can get the current state and history of an object by issuing a GET request using on any context:

http


HTTP/1.1 200 OK
Content-Type: application/json

{
  "@id": "http://localhost:55001/plone/front-page/@workflow", 
  "history": [
    {
      "action": null, 
      "actor": "test_user_1_", 
      "comments": "", 
      "review_state": "private", 
      "time": "2016-10-21T19:00:00+00:00", 
      "title": "Private"
    }
  ], 
  "transitions": [
    {
      "@id": "http://localhost:55001/plone/front-page/@workflow/publish", 
      "title": "Publish"
    }, 
    {
      "@id": "http://localhost:55001/plone/front-page/@workflow/submit", 
      "title": "Submit for publication"
    }
  ]
}

Now, if we want to change the state of the front page to publish, we would proceed by issuing a POST request to the given URL:

http


HTTP/1.1 200 OK
Content-Type: application/json

{
  "action": "publish", 
  "actor": "admin", 
  "comments": "", 
  "review_state": "published", 
  "time": "2016-10-21T19:05:00+00:00", 
  "title": "Published with accent \u00e9"
}

We can also also change the state recursively for all contained items, provide a comment and set effective and expiration dates:

http


HTTP/1.1 200 OK
Content-Type: application/json

{
  "action": "publish", 
  "actor": "admin", 
  "comments": "Publishing my folder...", 
  "review_state": "published", 
  "time": "2016-10-21T19:05:00+00:00", 
  "title": "Published with accent \u00e9"
}