Skip to content

Instances

Introduction

An Instance is a deep clone of a template and is associated with a Document group.

Usage

list

Retrieve a list of Instances.

Usage

const instances = await Xedi.Instances.list();

Response

[
{
"_id": "af6d8dfc-88b5-41f6-bbf5-825130390d64",
"name": "instance (order)",
"creator_id": "af6d8dfc-88b5-41f6-bbf5-825130390d64",
"connection_id": "cefda3331-ds33-41f6-bbf5-825130390d64",
"document_group_id" : "e939d2d7-1376-4ecb-bff4-e32356e3ae78",
"owner_id": "a56fd6e37-0048-4369-b438-cfcac7ea4a51",
"template_id": "83ca5c99-1e9d-4f1d-a33a-777682f94890",
"updated_by": "e5f3a20d-f6be-468f-b02c-c722ed8bbb4c",
"created_at": "2020-05-11 10:27:03",
"updated_at": "2020-05-11 10:27:03"
},
{
"_id": "3n1jnj13-88b5-41f6-bbf5-m31kmk31mk1m31",
"name": "instance (Invoice)",
"creator_id": "af6d8dfc-88b5-41f6-bbf5-825130390d64",
"connection_id": "cefda3331-ds33-41f6-bbf5-825130390d64",
"document_group_id" : "e939d2d7-1376-4ecb-bff4-e32356e3ae78",
"owner_id": "a56fd6e37-0048-4369-b438-cfcac7ea4a51",
"template_id": "83ca5c99-1e9d-4f1d-a33a-777682f94890",
"updated_by": "e5f3a20d-f6be-468f-b02c-c722ed8bbb4c",
"created_at": "2020-05-11 10:27:03",
"updated_at": "2020-05-11 10:27:03"
}
]

get

Retrieve a instance by Id.

Parameters

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

Usage

const instance = await Xedi.Instances.get('af6d8dfc-88b5-41f6-bbf5-825130390d64');

Response

{
"_id": "af6d8dfc-88b5-41f6-bbf5-825130390d64",
"name": "instance (order)",
"creator_id": "af6d8dfc-88b5-41f6-bbf5-825130390d64",
"connection_id": "cefda3331-ds33-41f6-bbf5-825130390d64",
"document_group_id" : "e939d2d7-1376-4ecb-bff4-e32356e3ae78",
"owner_id": "a56fd6e37-0048-4369-b438-cfcac7ea4a51",
"template_id": "83ca5c99-1e9d-4f1d-a33a-777682f94890",
"updated_by": "e5f3a20d-f6be-468f-b02c-c722ed8bbb4c",
"created_at": "2020-05-11 10:27:03",
"updated_at": "2020-05-11 10:27:03"
}

Create

Create a new Instance

Parameters

PropertyTypeRequiredExample
namestring'instance name (order)'
descriptionstring'instance name (order)'
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'
template_idXuid'af6d8dfc-88b5-41f6-bbf5-825130390d64'

Usage

const instance = await Xedi.Instances.create(
{
"name": "instance (order)",
"creator_id": "af6d8dfc-88b5-41f6-bbf5-825130390d64",
"connection_id": "cefda3331-ds33-41f6-bbf5-825130390d64",
"document_group_id" : "e939d2d7-1376-4ecb-bff4-e32356e3ae78",
"owner_id": "a56fd6e37-0048-4369-b438-cfcac7ea4a51",
"template_id": "83ca5c99-1e9d-4f1d-a33a-777682f94890",
"updated_by": "e5f3a20d-f6be-468f-b02c-c722ed8bbb4c",
}
);

Response

{
"_id": "af6d8dfc-88b5-41f6-bbf5-825130390d64",
"name": "instance (order)",
"creator_id": "af6d8dfc-88b5-41f6-bbf5-825130390d64",
"connection_id": "cefda3331-ds33-41f6-bbf5-825130390d64",
"document_group_id" : "e939d2d7-1376-4ecb-bff4-e32356e3ae78",
"owner_id": "a56fd6e37-0048-4369-b438-cfcac7ea4a51",
"template_id": "83ca5c99-1e9d-4f1d-a33a-777682f94890",
"updated_by": "e5f3a20d-f6be-468f-b02c-c722ed8bbb4c",
"created_at": "2020-05-11 10:27:03",
"updated_at": "2020-05-11 10:27:03"
}

Update

Update an existing instance.

Parameters

PropertyTypeRequiredExample
idXuid'af6d8dfc-88b5-41f6-bbf5-825130390d64'
namestring'Instance name (order)'
descriptionstring'Instance name (order)'
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'
template_idXuid'af6d8dfc-88b5-41f6-bbf5-825130390d64'

Usage

const instances = await Xedi.Instances.update(
{
"_id": "3n1jnj13-88b5-41f6-bbf5-m31kmk31mk1m31",
"name": "instance (order) v2",
"description" : "instance of an invoice",
"creator_id": "af6d8dfc-88b5-41f6-bbf5-825130390d64",
"connection_id": "cefda3331-ds33-41f6-bbf5-825130390d64",
"document_group_id" : "e939d2d7-1376-4ecb-bff4-e32356e3ae78",
"owner_id": "a56fd6e37-0048-4369-b438-cfcac7ea4a51",
"template_id": "83ca5c99-1e9d-4f1d-a33a-777682f94890",
"updated_by": "e5f3a20d-f6be-468f-b02c-c722ed8bbb4c",
}
);

Response

{
"_id": "3n1jnj13-88b5-41f6-bbf5-m31kmk31mk1m31",
"name": "instance (order) v2",
"description" : "instance of an invoice",
"creator_id": "af6d8dfc-88b5-41f6-bbf5-825130390d64",
"connection_id": "cefda3331-ds33-41f6-bbf5-825130390d64",
"document_group_id" : "e939d2d7-1376-4ecb-bff4-e32356e3ae78",
"owner_id": "a56fd6e37-0048-4369-b438-cfcac7ea4a51",
"template_id": "83ca5c99-1e9d-4f1d-a33a-777682f94890",
"updated_by": "e5f3a20d-f6be-468f-b02c-c722ed8bbb4c",
"created_at": "2020-05-11 10:27:03",
"updated_at": "2020-05-11 10:27:03"
}

Delete

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

Parameters

PropertyTypeRequiredExample
idXuid'3n1jnj13-88b5-41f6-bbf5-m31kmk31mk1m31'

Usage

const instance = await Xedi.Instances.delete('3n1jnj13-88b5-41f6-bbf5-m31kmk31mk1m31');

Response

{
"_id": "3n1jnj13-88b5-41f6-bbf5-m31kmk31mk1m31"
}

Restore

Restore will reinstate a deleted instance.

Parameters

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

Usage

const instances = await Xedi.Instances.restore('3n1jnj13-88b5-41f6-bbf5-m31kmk31mk1m31');

Response

{
"_id": "3n1jnj13-88b5-41f6-bbf5-m31kmk31mk1m31",
"name": "instance (order) v2",
"description" : "instance of an invoice",
"creator_id": "af6d8dfc-88b5-41f6-bbf5-825130390d64",
"connection_id": "cefda3331-ds33-41f6-bbf5-825130390d64",
"document_group_id" : "e939d2d7-1376-4ecb-bff4-e32356e3ae78",
"owner_id": "a56fd6e37-0048-4369-b438-cfcac7ea4a51",
"template_id": "83ca5c99-1e9d-4f1d-a33a-777682f94890",
"updated_by": "e5f3a20d-f6be-468f-b02c-c722ed8bbb4c",
"created_at": "2020-05-11 10:27:03",
"updated_at": "2020-05-11 10:27:03",
"deleted_at" : null
}