1. Update a Workflow Stage

Update a Workflow Stage

This endpoint can be used to update a workflow stage using the numeric ID.

https://mapi.storyblok.com/v1/spaces/:space_id/workflow_stages/:workflow_id

Path Parameters

  • :space_id

    required number

    Numeric ID of a space

  • :workflow_id

    required number

    Numeric ID of the connected workflow. If empty while creating a new stage, then the stage is created in the default workflow.

Request Body Properties

  • workflow_stage

    Workflow Stage Object

    A workflow stage object

    • allow_publish

      boolean

      Boolean to allow publishing for all the users in the stage

    • is_default

      boolean

      True if the workflow stage is the default one for a particular workflow. One workflow can only have one default stage.

    • user_ids

      number[]

      An array of user ids that are allowed to change the stage to next available stages

    • space_role_ids

      number[]

      Space role ids that are allowed to change the stage to the next available stages

    • workflow_stage_ids

      number[]

      An array of IDs of next available stages

    • name

      string

      The workflow stage name, cannot be the same as another stage in the same workflow.

    • color

      string

      Workflow stage color, two stages in the same workflow cannot have the same color

    • allow_all_stages

      boolean

      Boolean to allow all stages as the next available stages

    • allow_admin_publish

      boolean

      Boolean to allow admin publishing

    • allow_all_users

      boolean

      Boolean to allow changing the workflow stage by all users

    • allow_admin_change

      boolean

      Allow admins to change from the current stage to the next available stages

    • allow_editor_change

      boolean

      Allow editors to change from the current stage to the next available stages

    • position

      number

      Numeric position of the workflow stage in the workflow

    • after_publish_id

      number

      Workflow stage id that gets assigned after publishing

Request
curl "https://mapi.storyblok.com/v1/spaces/space_id/workflow_stages/18" \ 
  -X PUT \
  -H "Authorization: YOUR_OAUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d "{\"workflow_stage\": {\"allow_publish\": true,\"is_default\": true,\"user_ids\": [343434],\"space_role_ids\": [232323],\"workflow_stage_ids\": [561398],\"name\": \"an updated stage \",\"color\": \"#fff\",\"allow_all_stages\": false,\"allow_admin_publish\": false,\"allow_all_users\": false,\"allow_admin_change\": true,\"allow_editor_change\": true,\"position\": 2,\"after_publish_id\": 561398,}}"
Request
// Using the Universal JavaScript Client:
// https://github.com/storyblok/storyblok-js-client
Storyblok.put('/spaces/space_id/workflow_stages/18', {
  "workflow_stage": {
      "allow_publish": true,
      "is_default": true,
      "user_ids": [
          343434
      ],
      "space_role_ids": [
          232323
      ],
      "workflow_stage_ids": [
          561398
      ],
      "name": "an updated stage ",
      "color": "#fff",
      "allow_all_stages": false,
      "allow_admin_publish": false,
      "allow_all_users": false,
      "allow_admin_change": true,
      "allow_editor_change": true,
      "position": 2,
      "after_publish_id": 561398,
  }
})
  .then(response => {
    console.log(response)
  }).catch(error => { 
    console.log(error)
  })
Request
$client = new \Storyblok\ManagementClient('YOUR_OAUTH_TOKEN');

$payload = [
  "workflow_stage" =>  [
      "allow_publish" =>  true,
      "is_default" =>  true,
      "user_ids" =>  [
          343434
      ],
      "space_role_ids" =>  [
          232323
      ],
      "workflow_stage_ids" =>  [
          561398
      ],
      "name" =>  "an updated stage ",
      "color" =>  "#fff",
      "allow_all_stages" =>  false,
      "allow_admin_publish" =>  false,
      "allow_all_users" =>  false,
      "allow_admin_change" =>  true,
      "allow_editor_change" =>  true,
      "position" =>  2,
      "after_publish_id" =>  561398,
  ]
];

$client->put('/spaces/space_id/workflow_stages/18', $payload)->getBody();
Request
require 'storyblok'
client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')

payload = {
  "workflow_stage" =>  {
      "allow_publish" =>  true,
      "is_default" =>  true,
      "user_ids" =>  [
          343434
      ],
      "space_role_ids" =>  [
          232323
      ],
      "workflow_stage_ids" =>  [
          561398
      ],
      "name" =>  "an updated stage ",
      "color" =>  "#fff",
      "allow_all_stages" =>  false,
      "allow_admin_publish" =>  false,
      "allow_all_users" =>  false,
      "allow_admin_change" =>  true,
      "allow_editor_change" =>  true,
      "position" =>  2,
      "after_publish_id" =>  561398,
  }
}

client.put('/spaces/space_id/workflow_stages/18', payload)
Request
HttpResponse<String> response = Unirest.put("https://mapi.storyblok.com/v1/spaces/space_id/workflow_stages/18")
  .header("Content-Type", "application/json")
  .header("Authorization", "YOUR_OAUTH_TOKEN")
  .body("{\"workflow_stage\": {\"allow_publish\": true,\"is_default\": true,\"user_ids\": [343434],\"space_role_ids\": [232323],\"workflow_stage_ids\": [561398],\"name\": \"an updated stage \",\"color\": \"#fff\",\"allow_all_stages\": false,\"allow_admin_publish\": false,\"allow_all_users\": false,\"allow_admin_change\": true,\"allow_editor_change\": true,\"position\": 2,\"after_publish_id\": 561398,}}")
  .asString();
Request
var client = new RestClient("https://mapi.storyblok.com/v1/spaces/space_id/workflow_stages/18");
var request = new RestRequest(Method.PUT);

request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
request.AddParameter("application/json", "{\"workflow_stage\": {\"allow_publish\": true,\"is_default\": true,\"user_ids\": [343434],\"space_role_ids\": [232323],\"workflow_stage_ids\": [561398],\"name\": \"an updated stage \",\"color\": \"#fff\",\"allow_all_stages\": false,\"allow_admin_publish\": false,\"allow_all_users\": false,\"allow_admin_change\": true,\"allow_editor_change\": true,\"position\": 2,\"after_publish_id\": 561398,}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Request
import Foundation

let headers = [
  "Content-Type": "application/json",
  "Authorization": "YOUR_OAUTH_TOKEN"
]

let postData = NSData(data: "{\"workflow_stage\": {\"allow_publish\": true,\"is_default\": true,\"user_ids\": [343434],\"space_role_ids\": [232323],\"workflow_stage_ids\": [561398],\"name\": \"an updated stage \",\"color\": \"#fff\",\"allow_all_stages\": false,\"allow_admin_publish\": false,\"allow_all_users\": false,\"allow_admin_change\": true,\"allow_editor_change\": true,\"position\": 2,\"after_publish_id\": 561398,}}".data(using: String.Encoding.utf8)!)

let request = NSMutableURLRequest(url: NSURL(string: "https://mapi.storyblok.com/v1/spaces/space_id/workflow_stages/18")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)
request.method = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
Request
import requests

url = "https://mapi.storyblok.com/v1/spaces/space_id/workflow_stages/18"

querystring = {}

payload = "{\"workflow_stage\": {\"allow_publish\": true,\"is_default\": true,\"user_ids\": [343434],\"space_role_ids\": [232323],\"workflow_stage_ids\": [561398],\"name\": \"an updated stage \",\"color\": \"#fff\",\"allow_all_stages\": false,\"allow_admin_publish\": false,\"allow_all_users\": false,\"allow_admin_change\": true,\"allow_editor_change\": true,\"position\": 2,\"after_publish_id\": 561398,}}"
headers = {
  'Content-Type': "application/json",
  'Authorization': "YOUR_OAUTH_TOKEN"
}

response = requests.request("PUT", url, data=payload, headers=headers, params=querystring)

print(response.text)