1. Update a Workflow Stage

Update a Workflow Stage

Update a workflow stage

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

Request Body Properties

  • workflow_stage_object

    Workflow Stage Object
    • id

      number

      The numeric ID

    • after_publish_id

      number

      Workflow stage id that gets assigned after publishing

    • allow_publish

      boolean

      Boolean to allow publishing

    • is_default

      boolean

      Boolean to set as the default workflow

    • position

      number

      Numeric representation of the story's position in the folder

    • allow_all_stages

      boolean

      Boolean to allow all stages

    • allow_all_users

      boolean

      Boolean to allow change to all users

    • name

      string

      Workflow name

    • color

      string

      Workflow color

    • user_ids

      number

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

    • space_role_ids

      number[]

      Space role ids that are allowed to change the stage

    • workflow_stage_ids

      number

      An array of workflow stage ids the user can change the stage to

    • workflow_id

      number

      Numeric ID of the connected workflow

    • 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

Response Properties

  • workflow_stage_object

    Workflow Stage Object
    • id

      number

      The numeric ID

    • after_publish_id

      number

      Workflow stage id that gets assigned after publishing

    • allow_publish

      boolean

      Boolean to allow publishing

    • is_default

      boolean

      Boolean to set as the default workflow

    • position

      number

      Numeric representation of the story's position in the folder

    • allow_all_stages

      boolean

      Boolean to allow all stages

    • allow_all_users

      boolean

      Boolean to allow change to all users

    • name

      string

      Workflow name

    • color

      string

      Workflow color

    • user_ids

      number

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

    • space_role_ids

      number[]

      Space role ids that are allowed to change the stage

    • workflow_stage_ids

      number

      An array of workflow stage ids the user can change the stage to

    • workflow_id

      number

      Numeric ID of the connected workflow

    • 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

Request
curl "https://mapi.storyblok.com/v1/spaces/space_id/workflow_stages/workflow_id" \ 
  -X PUT \
  -H "Authorization: YOUR_OAUTH_TOKEN" \
  -H "Content-Type: application/json" \
  -d "{\"workflow_stage\": {\"after_publish_id\": [],\"allow_publish\": [],\"is_default\": false,\"position\": 0,\"allow_all_stages\": true,\"allow_all_users\": true,\"name\": \"Ready to Publish\",\"color\": \"#333\",\"user_ids\": [],\"space_role_ids\": [],\"workflow_stage_ids\": []}}"
Request
// Using the Universal JavaScript Client:
// https://github.com/storyblok/storyblok-js-client
Storyblok.put('/spaces/space_id/workflow_stages/workflow_id', {
  "workflow_stage": {
    "after_publish_id": [],
    "allow_publish": [],
    "is_default": false,
    "position": 0,
    "allow_all_stages": true,
    "allow_all_users": true,
    "name": "Ready to Publish",
    "color": "#333",
    "user_ids": [],
    "space_role_ids": [],
    "workflow_stage_ids": []
  }
})
  .then(response => {
    console.log(response)
  }).catch(error => { 
    console.log(error)
  })
Request
$client = new \Storyblok\Client('YOUR_STORYBLOK_SPACE_ACCESS_TOKEN');

$payload = [
  "workflow_stage" =>  [
    "after_publish_id" =>  [],
    "allow_publish" =>  [],
    "is_default" =>  false,
    "position" =>  0,
    "allow_all_stages" =>  true,
    "allow_all_users" =>  true,
    "name" =>  "Ready to Publish",
    "color" =>  "#333",
    "user_ids" =>  [],
    "space_role_ids" =>  [],
    "workflow_stage_ids" =>  []
  ]
];

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

payload = {
  "workflow_stage" =>  {
    "after_publish_id" =>  [],
    "allow_publish" =>  [],
    "is_default" =>  false,
    "position" =>  0,
    "allow_all_stages" =>  true,
    "allow_all_users" =>  true,
    "name" =>  "Ready to Publish",
    "color" =>  "#333",
    "user_ids" =>  [],
    "space_role_ids" =>  [],
    "workflow_stage_ids" =>  []
  }
}

client.put('/spaces/space_id/workflow_stages/workflow_id', payload)
Request
HttpResponse<String> response = Unirest.put("https://mapi.storyblok.com/v1/spaces/space_id/workflow_stages/workflow_id")
  .header("Content-Type", "application/json")
  .header("Authorization", "YOUR_OAUTH_TOKEN")
  .body("{\"workflow_stage\": {\"after_publish_id\": [],\"allow_publish\": [],\"is_default\": false,\"position\": 0,\"allow_all_stages\": true,\"allow_all_users\": true,\"name\": \"Ready to Publish\",\"color\": \"#333\",\"user_ids\": [],\"space_role_ids\": [],\"workflow_stage_ids\": []}}")
  .asString();
Request
var client = new RestClient("https://mapi.storyblok.com/v1/spaces/space_id/workflow_stages/workflow_id");
var request = new RestRequest(Method.PUT);

request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
request.AddParameter("application/json", "{\"workflow_stage\": {\"after_publish_id\": [],\"allow_publish\": [],\"is_default\": false,\"position\": 0,\"allow_all_stages\": true,\"allow_all_users\": true,\"name\": \"Ready to Publish\",\"color\": \"#333\",\"user_ids\": [],\"space_role_ids\": [],\"workflow_stage_ids\": []}}", 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\": {\"after_publish_id\": [],\"allow_publish\": [],\"is_default\": false,\"position\": 0,\"allow_all_stages\": true,\"allow_all_users\": true,\"name\": \"Ready to Publish\",\"color\": \"#333\",\"user_ids\": [],\"space_role_ids\": [],\"workflow_stage_ids\": []}}".data(using: String.Encoding.utf8)!)

let request = NSMutableURLRequest(url: NSURL(string: "https://mapi.storyblok.com/v1/spaces/space_id/workflow_stages/workflow_id")! 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/workflow_id"

querystring = {}

payload = "{\"workflow_stage\": {\"after_publish_id\": [],\"allow_publish\": [],\"is_default\": false,\"position\": 0,\"allow_all_stages\": true,\"allow_all_users\": true,\"name\": \"Ready to Publish\",\"color\": \"#333\",\"user_ids\": [],\"space_role_ids\": [],\"workflow_stage_ids\": []}}"
headers = {
  'Content-Type': "application/json",
  'Authorization': "YOUR_OAUTH_TOKEN"
}

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

print(response.text)