Skip to content

Stages

Introduction

The Stages API gives the ability to fully configure each stage of a workflow template.

Usage

list

Retreive the list of stages.

Usage

const stages = await Xedi.Stages.list();

Response

[
{
"_id": "f188a18a-a0fe-11ea-afae-0242ac120002",
"name": "My first stage",
"workflow_id": "",
"document_type_id": "cec6b1ae-a63b-11ea-ae1c-01009cb3fa40",
"workflow_type": "template",
"state": "pending",
"created_at": "2020-05-11 10:27:03",
"updated_at": "2020-05-11 10:27:03"
}
{
"_id": "f188a18a-a0fe-11ea-afae-0242ac120002",
"name": "My second stage",
"workflow_id": "",
"document_type_id": "cec6b1ae-a63b-11ea-ae1c-01009cb3fa40",
"workflow_type": "template",
"state": "pending",
"created_at": "2020-05-11 10:27:03",
"updated_at": "2020-05-11 10:27:03"
}
]

get

Retrieve a stage by Id.

Parameters

PropertyTypeRequiredExample
idXuid'f188a18a-a0fe-11ea-afae-0242ac120002'

Usage

const stage = await Xedi.Stages.get('f188a18a-a0fe-11ea-afae-0242ac120002');

Response

{
"_id": "f188a18a-a0fe-11ea-afae-0242ac120002",
"name": "My first stage",
"workflow_id": "",
"document_type_id": "cec6b1ae-a63b-11ea-ae1c-01009cb3fa40",
"workflow_type": "template",
"state": "pending",
"created_at": "2020-05-11 10:27:03",
"updated_at": "2020-05-11 10:27:03"
}

Create

Create a new stage

Parameters

PropertyTypeRequiredExample
namestringStage name
workflow_idXuidcec6b1ae-a63b-11ea-ae1c-01009cb3fa40
document_type_idXuidcec6b1ae-a63b-11ea-ae1c-01009cb3fa40 todo change this for a document_type_id
workflow_typeenumtemplate
stateenumpending

Usage

const stage = await Xedi.Stages.create(
{
name: 'new Stage',
workflow_id: 'cec6b1ae-a63b-11ea-ae1c-01009cb3fa40',
document_type_id: 'cec6b1ae-a63b-11ea-ae1c-01009cb3fa40',
workflow_type: 'template',
state: 'pending'
}
);

Response

{
"_id": "f188a18a-a0fe-11ea-afae-0242ac120002",
"name": "new Stage",
"workflow_id": "cec6b1ae-a63b-11ea-ae1c-01009cb3fa40",
"document_type_id": "cec6b1ae-a63b-11ea-ae1c-01009cb3fa40",
"workflow_type": "template",
"state": "pending",
"created_at": "2020-05-11 10:27:03",
"updated_at": "2020-05-11 10:27:03"
}

Update

Update an existing stage.

Parameters

PropertyTypeRequiredExample
namestringStage name
workflow_idXuidcec6b1ae-a63b-11ea-ae1c-01009cb3fa40
document_type_idXuidcec6b1ae-a63b-11ea-ae1c-01009cb3fa40 todo change this for a document_type_id
workflow_typeenumtemplate
stateenumpending

Usage

const stage = await Xedi.Stages.update(
{
_id: 'f188a18a-a0fe-11ea-afae-0242ac120002'
name: 'Updated Stage',
workflow_id: 'cec6b1ae-a63b-11ea-ae1c-01009cb3fa40',
document_type_id: 'cec6b1ae-a63b-11ea-ae1c-01009cb3fa40',
workflow_type: 'template',
state: 'pending'
}
);

Response

{
"_id": "f188a18a-a0fe-11ea-afae-0242ac120002",
"name": "Updated Stage",
"workflow_id": "cec6b1ae-a63b-11ea-ae1c-01009cb3fa40",
"document_type_id": "cec6b1ae-a63b-11ea-ae1c-01009cb3fa40",
"workflow_type": "template",
"state": "pending",
"created_at": "2020-05-11 10:27:03",
"updated_at": "2020-05-11 10:27:03"
}

Delete

Delete a stage.

Parameters

PropertyTypeRequiredExample
idXuid'f188a18a-a0fe-11ea-afae-0242ac120002'

Usage

const stage = await Xedi.Stages.delete('f188a18a-a0fe-11ea-afae-0242ac120002');

Response

{
"_id": "f188a18a-a0fe-11ea-afae-0242ac120002"
}
Edit this page on GitHub
2 contributorssamb20midmiddleton
Last edited by samb20 on September 4, 2020