Sorry, no results found for "".

Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > Workflow

Update a workflow

Body parameters

type string Required

Must be exactly "workflow".

attributes.name string Optional

The name of the workflow

Example: "Approval by editors required"
attributes.api_key string Optional

Workflow API key

Example: "approval_by_editors"
attributes.stages Optional

The stages of the workflow

Type: Array<object>
Example: [{ id: "waiting_for_review", name: "Waiting for review", initial: true }]
id string Required

ID of the stage

Example: "waiting_for_review"
name string Required

Name of the stage

Example: "Waiting for review"
description string, null Optional

Description of the stage

Example: "Editor has finished writing and is waiting for approval from a supervisor"
initial boolean Optional

Whether this is the initial stage or not

Returns

Returns a resource object of type workflow.

Examples

PUT https://site-api.datocms.com/workflows/:workflow_id HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Content-Type: application/vnd.api+json
{
"data": {
"type": "workflow",
"id": "uJzC2b6YQg-DW2A5edpQYQ"
}
}
Terminal window
curl -g 'https://site-api.datocms.com/workflows/:workflow_id' \
-X PUT \
-H "Authorization: Bearer YOUR-API-TOKEN" \
-H "Accept: application/json" \
-H "X-Api-Version: 3" \
-H "Content-Type: application/vnd.api+json" \
--data-binary '{"data":{"type":"workflow","id":"uJzC2b6YQg-DW2A5edpQYQ"}}'
await fetch("https://site-api.datocms.com/workflows/:workflow_id", {
method: "PUT",
headers: {
Authorization: "Bearer YOUR-API-TOKEN",
Accept: "application/json",
"X-Api-Version": "3",
"Content-Type": "application/vnd.api+json",
},
body: JSON.stringify({
data: { type: "workflow", id: "uJzC2b6YQg-DW2A5edpQYQ" },
}),
});
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: cache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 28
{
"data": {
"type": "workflow",
"id": "uJzC2b6YQg-DW2A5edpQYQ",
"attributes": {
"name": "Approval by editors required",
"stages": [
{
"id": "waiting_for_review",
"name": "Waiting for review",
"initial": true
}
],
"api_key": "approval_by_editors"
}
}
}