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 numberNumeric ID of a space
-
:workflow_id
required numberNumeric 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 ObjectA workflow stage object
-
allow_publish
booleanBoolean to allow publishing for all the users in the stage
-
is_default
booleanTrue 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
stringThe workflow stage name, cannot be the same as another stage in the same workflow.
-
color
stringWorkflow stage color, two stages in the same workflow cannot have the same color
-
allow_all_stages
booleanBoolean to allow all stages as the next available stages
-
allow_admin_publish
booleanBoolean to allow admin publishing
-
allow_all_users
booleanBoolean to allow changing the workflow stage by all users
-
allow_admin_change
booleanAllow admins to change from the current stage to the next available stages
-
allow_editor_change
booleanAllow editors to change from the current stage to the next available stages
-
position
numberNumeric position of the workflow stage in the workflow
-
after_publish_id
numberWorkflow stage id that gets assigned after publishing
-
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,}}"
// Using the Universal JavaScript Client:
// https://github.com/storyblok/storyblok-js-client
Storyblok.put('cdn/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)
})
$client = new \Storyblok\Client('YOUR_STORYBLOK_SPACE_ACCESS_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();
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)
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();
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);
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()
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)