Create a Workflow Stage
This endpoint allows you to create a workflow stage.
https://mapi.storyblok.com/v1/spaces/:space_id/workflow_stages
Path Parameters
-
:space_id
required numberNumeric ID of a space
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
required stringThe workflow stage name, cannot be the same as another stage in the same workflow.
-
color
required 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
-
after_publish_id
numberWorkflow stage id that gets assigned after publishing
-
workflow_id
numberNumeric ID of the connected workflow. If empty while creating a new stage, then the stage is created in the default workflow.
-
Response Properties
-
workflow_stage
Workflow Stage ObjectA workflow stage object
-
id
numberThe numeric ID
-
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
-
workflow_id
numberNumeric ID of the connected workflow. If empty while creating a new stage, then the stage is created in the default workflow.
-
curl "https://mapi.storyblok.com/v1/spaces/space_id/workflow_stages" \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: YOUR_OAUTH_TOKEN" \
-d "{\"workflow_stage\":{\"allow_publish\": true,\"is_default\": false,\"user_ids\": [123123],\"space_role_ids\": [111111,222222],\"workflow_stage_ids\": [561398],\"name\": \"testb\",\"color\": \"#2d3v22\",\"allow_all_stages\": false,\"allow_admin_publish\": true,\"allow_all_users\": false,\"allow_admin_change\": true,\"allow_editor_change\": false,\"position\": 3,\"after_publish_id\": 561398,\"workflow_id\": 43112 }}"
// Using the Universal JavaScript Client:
// https://github.com/storyblok/storyblok-js-client
Storyblok.post('cdn/spaces/space_id/workflow_stages', {
"workflow_stage":{
"allow_publish": true,
"is_default": false,
"user_ids": [
123123
],
"space_role_ids": [
111111,
222222
],
"workflow_stage_ids": [
561398
],
"name": "testb",
"color": "#2d3v22",
"allow_all_stages": false,
"allow_admin_publish": true,
"allow_all_users": false,
"allow_admin_change": true,
"allow_editor_change": false,
"position": 3,
"after_publish_id": 561398,
"workflow_id": 43112
}
})
.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" => false,
"user_ids" => [
123123
],
"space_role_ids" => [
111111,
222222
],
"workflow_stage_ids" => [
561398
],
"name" => "testb",
"color" => "#2d3v22",
"allow_all_stages" => false,
"allow_admin_publish" => true,
"allow_all_users" => false,
"allow_admin_change" => true,
"allow_editor_change" => false,
"position" => 3,
"after_publish_id" => 561398,
"workflow_id" => 43112
]
];
$client->post('/spaces/space_id/workflow_stages', $payload)->getBody();
require 'storyblok'
client = Storyblok::Client.new(oauth_token: 'YOUR_OAUTH_TOKEN')
payload = {
"workflow_stage" => {
"allow_publish" => true,
"is_default" => false,
"user_ids" => [
123123
],
"space_role_ids" => [
111111,
222222
],
"workflow_stage_ids" => [
561398
],
"name" => "testb",
"color" => "#2d3v22",
"allow_all_stages" => false,
"allow_admin_publish" => true,
"allow_all_users" => false,
"allow_admin_change" => true,
"allow_editor_change" => false,
"position" => 3,
"after_publish_id" => 561398,
"workflow_id" => 43112
}
}
client.post('/spaces/space_id/workflow_stages', payload)
HttpResponse<String> response = Unirest.post("https://mapi.storyblok.com/v1/spaces/space_id/workflow_stages")
.header("Content-Type", "application/json")
.header("Authorization", "YOUR_OAUTH_TOKEN")
.body("{\"workflow_stage\":{\"allow_publish\": true,\"is_default\": false,\"user_ids\": [123123],\"space_role_ids\": [111111,222222],\"workflow_stage_ids\": [561398],\"name\": \"testb\",\"color\": \"#2d3v22\",\"allow_all_stages\": false,\"allow_admin_publish\": true,\"allow_all_users\": false,\"allow_admin_change\": true,\"allow_editor_change\": false,\"position\": 3,\"after_publish_id\": 561398,\"workflow_id\": 43112 }}")
.asString();
var client = new RestClient("https://mapi.storyblok.com/v1/spaces/space_id/workflow_stages");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "YOUR_OAUTH_TOKEN");
request.AddParameter("application/json", "{\"workflow_stage\":{\"allow_publish\": true,\"is_default\": false,\"user_ids\": [123123],\"space_role_ids\": [111111,222222],\"workflow_stage_ids\": [561398],\"name\": \"testb\",\"color\": \"#2d3v22\",\"allow_all_stages\": false,\"allow_admin_publish\": true,\"allow_all_users\": false,\"allow_admin_change\": true,\"allow_editor_change\": false,\"position\": 3,\"after_publish_id\": 561398,\"workflow_id\": 43112 }}", 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\": false,\"user_ids\": [123123],\"space_role_ids\": [111111,222222],\"workflow_stage_ids\": [561398],\"name\": \"testb\",\"color\": \"#2d3v22\",\"allow_all_stages\": false,\"allow_admin_publish\": true,\"allow_all_users\": false,\"allow_admin_change\": true,\"allow_editor_change\": false,\"position\": 3,\"after_publish_id\": 561398,\"workflow_id\": 43112 }}".data(using: String.Encoding.utf8)!)
let request = NSMutableURLRequest(url: NSURL(string: "https://mapi.storyblok.com/v1/spaces/space_id/workflow_stages")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0)
request.method = "POST"
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"
querystring = {}
payload = "{\"workflow_stage\":{\"allow_publish\": true,\"is_default\": false,\"user_ids\": [123123],\"space_role_ids\": [111111,222222],\"workflow_stage_ids\": [561398],\"name\": \"testb\",\"color\": \"#2d3v22\",\"allow_all_stages\": false,\"allow_admin_publish\": true,\"allow_all_users\": false,\"allow_admin_change\": true,\"allow_editor_change\": false,\"position\": 3,\"after_publish_id\": 561398,\"workflow_id\": 43112 }}"
headers = {
'Content-Type': "application/json",
'Authorization': "YOUR_OAUTH_TOKEN"
}
response = requests.request("POST", url, data=payload, headers=headers, params=querystring)
print(response.text)