An Instance is a deep clone of a template and is associated with a Document group.
Retrieve a list of Instances.
const instances = await Xedi.Instances.list();
[{"_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"}]
Retrieve a instance by Id.
Property | Type | Required | Example |
---|---|---|---|
id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' |
const instance = await Xedi.Instances.get('af6d8dfc-88b5-41f6-bbf5-825130390d64');
{"_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 a new Instance
Property | Type | Required | Example |
---|---|---|---|
name | string | 'instance name (order)' | |
description | string | 'instance name (order)' | |
creator_id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' | |
connection_id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' | |
document_group_id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' | |
owner_id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' | |
template_id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' |
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",});
{"_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 an existing instance.
Property | Type | Required | Example |
---|---|---|---|
id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' | |
name | string | 'Instance name (order)' | |
description | string | 'Instance name (order)' | |
creator_id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' | |
connection_id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' | |
document_group_id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' | |
owner_id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' | |
template_id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' |
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",});
{"_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 a Instance. Response contains a deleted_at flag which signifies it has been deleted.
Property | Type | Required | Example |
---|---|---|---|
id | Xuid | '3n1jnj13-88b5-41f6-bbf5-m31kmk31mk1m31' |
const instance = await Xedi.Instances.delete('3n1jnj13-88b5-41f6-bbf5-m31kmk31mk1m31');
{"_id": "3n1jnj13-88b5-41f6-bbf5-m31kmk31mk1m31"}
Restore will reinstate a deleted instance.
Property | Type | Required | Example |
---|---|---|---|
id | Xuid | 'af6d8dfc-88b5-41f6-bbf5-825130390d64' |
const instances = await Xedi.Instances.restore('3n1jnj13-88b5-41f6-bbf5-m31kmk31mk1m31');
{"_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}