Skip to content

Templates

Introduction

A workflow can be of be a type of instance or template. A workflow without a business defined is referred to as a template (link)

Usage

list

Retrieve a list of Templates.

Usage

const templates = await Xedi.Templates.list();

Response

[
{
"_id": "c490e097-b232-4ee7-8958-2310a6060063",
"name": "template name (order)",
"is_template": 1,
"creator_id": "fe615d30-05aa-448a-bd2a-0859816f0922",
"connection_id": "4cd84112-bd8b-481b-adc8-3fd9483c3d71",
"document_group_id" : "71aff4cc-9de2-4f4f-b140-d6d25982dd09",
"owner_id": "8b3e0c15-65fd-4588-afd6-ae4fa0f40351",
"created_at": "2020-05-11 10:27:03",
"updated_at": "2020-05-11 10:27:03"
},
{
"_id": "e997904e-6a3b-40db-b1e0-19c13b541ed7",
"name": "template name (invoice)",
"is_template": 1,
"creator_id": "33e887f0-1709-4475-b78d-95bae3ac0349",
"connection_id": "2ece6a69-8d57-4f77-9e3e-55a017ba66b0",
"document_group_id" : "42c30ce2-1463-4877-b8a4-9d9b6e294859",
"owner_id": "ab994a41-db9d-4583-8b80-080029c0c569",
"created_at": "2020-05-11 10:27:03",
"updated_at": "2020-05-11 10:27:03"
}
]

get

Retrieve a template by Id.

Parameters

PropertyTypeRequiredExample
idXuid'af6d8dfc-88b5-41f6-bbf5-825130390d64'

Usage

const template = await Xedi.Templates.get('c490e097-b232-4ee7-8958-2310a6060063');

Response

{
"_id": "c490e097-b232-4ee7-8958-2310a6060063",
"name": "template name (order)",
"is_template": 1,
"creator_id": "fe615d30-05aa-448a-bd2a-0859816f0922",
"connection_id": "4cd84112-bd8b-481b-adc8-3fd9483c3d71",
"document_group_id" : "71aff4cc-9de2-4f4f-b140-d6d25982dd09",
"owner_id": "8b3e0c15-65fd-4588-afd6-ae4fa0f40351",
"created_at": "2020-05-11 10:27:03",
"updated_at": "2020-05-11 10:27:03"
}

Create

Create a new template

Parameters

PropertyTypeRequiredExample
idXuid'af6d8dfc-88b5-41f6-bbf5-825130390d64'
namestring'template name (order)'
is_templatebooleantrue
creator_idXuid'af6d8dfc-88b5-41f6-bbf5-825130390d64'
connection_idXuid'af6d8dfc-88b5-41f6-bbf5-825130390d64'
document_group_idXuid'af6d8dfc-88b5-41f6-bbf5-825130390d64'
owner_idXuid'af6d8dfc-88b5-41f6-bbf5-825130390d64'

Usage

const template = await Xedi.Templates.create(
{
"name": "template name (order)",
"is_template": 1,
"creator_id": "fe615d30-05aa-448a-bd2a-0859816f0922",
"connection_id": "4cd84112-bd8b-481b-adc8-3fd9483c3d71",
"document_group_id" : "71aff4cc-9de2-4f4f-b140-d6d25982dd09",
"owner_id": "8b3e0c15-65fd-4588-afd6-ae4fa0f40351",
}
);

Response

{
"_id": "c490e097-b232-4ee7-8958-2310a6060063",
"name": "template name (order)",
"is_template": 1,
"creator_id": "fe615d30-05aa-448a-bd2a-0859816f0922",
"connection_id": "4cd84112-bd8b-481b-adc8-3fd9483c3d71",
"document_group_id" : "71aff4cc-9de2-4f4f-b140-d6d25982dd09",
"owner_id": "8b3e0c15-65fd-4588-afd6-ae4fa0f40351",
"created_at": "2020-05-11 10:27:03",
"updated_at": "2020-05-11 10:27:03"
}

Update

Update an existing Template.

Parameters

PropertyTypeRequiredExample
idXuid'af6d8dfc-88b5-41f6-bbf5-825130390d64'
namestring'template name (order)'
is_templatebooleantrue
creator_idXuid'af6d8dfc-88b5-41f6-bbf5-825130390d64'
connection_idXuid'af6d8dfc-88b5-41f6-bbf5-825130390d64'
document_group_idXuid'af6d8dfc-88b5-41f6-bbf5-825130390d64'
owner_idXuid'af6d8dfc-88b5-41f6-bbf5-825130390d64'

Usage

const template = await Xedi.Templates.update(
{
"_id": "c490e097-b232-4ee7-8958-2310a6060063",
"name": "template name (order) v2",
"is_template": 1,
"creator_id": "fe615d30-05aa-448a-bd2a-0859816f0922",
"connection_id": "4cd84112-bd8b-481b-adc8-3fd9483c3d71",
"document_group_id" : "71aff4cc-9de2-4f4f-b140-d6d25982dd09",
"owner_id": "8b3e0c15-65fd-4588-afd6-ae4fa0f40351",
}
);

Response

{
"_id": "c490e097-b232-4ee7-8958-2310a6060063",
"name": "template name (order) v2",
"is_template": 1,
"creator_id": "fe615d30-05aa-448a-bd2a-0859816f0922",
"connection_id": "4cd84112-bd8b-481b-adc8-3fd9483c3d71",
"document_group_id" : "71aff4cc-9de2-4f4f-b140-d6d25982dd09",
"owner_id": "8b3e0c15-65fd-4588-afd6-ae4fa0f40351",
"created_at": "2020-05-11 10:27:03",
"updated_at": "2020-05-11 10:27:03"
}

Delete

Delete a Template. Response contains a deleted_at flag which signifies it has been deleted.

Parameters

PropertyTypeRequiredExample
idXuid'af6d8dfc-88b5-41f6-bbf5-825130390d64'

Usage

const template = await Xedi.Templates.delete('c490e097-b232-4ee7-8958-2310a6060063');

Response

{
"_id": "c490e097-b232-4ee7-8958-2310a6060063"
}

Restore

Restore will reinstate a deleted template.

Parameters

PropertyTypeRequiredExample
idXuid'af6d8dfc-88b5-41f6-bbf5-825130390d64'

Usage

const template = await Xedi.Templates.restore('c490e097-b232-4ee7-8958-2310a6060063');

Response

{
"_id": "c490e097-b232-4ee7-8958-2310a6060063",
"name": "template name (order) v2",
"is_template": 1,
"creator_id": "fe615d30-05aa-448a-bd2a-0859816f0922",
"connection_id": "4cd84112-bd8b-481b-adc8-3fd9483c3d71",
"document_group_id" : "71aff4cc-9de2-4f4f-b140-d6d25982dd09",
"owner_id": "8b3e0c15-65fd-4588-afd6-ae4fa0f40351",
"created_at": "2020-05-11 10:27:03",
"updated_at": "2020-05-11 10:27:03"
}
Edit this page on GitHub
2 contributorssamb20Smudge3806
Last edited by samb20 on September 4, 2020