Workflow

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

GET /news/@workflow HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImZ1bGxuYW1lIjoiQWRtaW4iLCJpYXQiOjE2NDkzMTI0NDl9.RS1Ny_r0v7vIylFfK6q0JVJrkiDuTOh9iG9IL8xbzAk

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

{
  "@id": "http://localhost:8080/news/@workflow",
  "history": [],
  "state": {
    "id": "published",
    "title": "Published"
  },
  "transitions": [
    {
      "@id": "http://localhost:8080/news/@workflow/reject",
      "title": "Send back"
    },
    {
      "@id": "http://localhost:8080/news/@workflow/retract",
      "title": "Retract"
    }
  ]
}

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:

POST /news/my-news-item/@workflow/publish HTTP/1.1
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhZG1pbiIsImZ1bGxuYW1lIjoiQWRtaW4iLCJpYXQiOjE2NDkzMTI0NDl9.RS1Ny_r0v7vIylFfK6q0JVJrkiDuTOh9iG9IL8xbzAk

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

{
  "action": "publish",
  "actor": "admin",
  "comments": "",
  "review_state": "published",
  "time": "2022-04-08T16:00:00.000Z",
  "title": "Published"
}