Choose your language:
    Update a workflow
    Parameters
    name  string  Optional

    The name of the workflow

    stages  Array<object>  Optional

    The stages of the workflow

    Returns
    Returns a workflow object.

    Examples

    Example code:
    const SiteClient = require('datocms-client').SiteClient;
    const client = new SiteClient('YOUR-API-TOKEN');
    const workflowId = 'approval_by_editors';
    client.workflow.update(workflowId, {
    name: 'Approval by editors required',
    stages: [
    {
    id: 'waiting_for_review',
    name: 'Waiting for review',
    initial: true
    }
    ]
    })
    .then((workflow) => {
    console.log(workflow);
    })
    .catch((error) => {
    console.error(error);
    });
    Returned output:
    > node example.js
    {
    "id": "approval_by_editors",
    "name": "Approval by editors required",
    "stages": [
    {
    "id": "waiting_for_review",
    "name": "Waiting for review",
    "initial": true
    }
    ]
    }