Entity
Get entities
Section titled “Get entities”{{include:includes/entity/_get-entities.md}}
Get entity
Section titled “Get entity”{{include:includes/entity/_get-entity.md}}
Create/update entities
Section titled “Create/update entities”POST /api/entity
Create new entities or update existing entities.
Request
Body
{ "entities": [{ "id": string, "eClass": string, ... },...]}entitiesThe entities to create or update. TheeClassis required. Ifidis set and is found in the database, an existing entity will be updated with the given property values.
Functional notation:
#Used for referencing anid,name, orbarcodevariable. The variable will be replaced with auto-generated IDs by backend, or the alias it refers to.#in conjunction with., e.g.#idReq.namerefers to the name of a entity withid#idReq.!Used for switching eClass prefix. Can only be used onidvariables. Changes auto-generated ID from default eClass prefix to written eClass prefix.
# and ! can be used together in ID fields, e.g. "id": "#idRef!nameSeq".
Special properties:
notes: A list of notes that will have the entity in question as subject.files: A list of files that will have the entity in question as subject.inputforStep:StepInputassociated records are created based on this.
Default values:
The following properties have defaults:
name: fallback to IDuserID: fallback to currently logged in userdepartmentID: fallback to currently logged in user’s departmentstatus: Initial, unless datamodel states differentlytype: Other
These audit properties are not editable and set automatically: createdBy, createdUtc, modifiedBy, modifiedUtc, version.
Response
The created entities:
{ "entities": [{ "id": string, "eClass": string, ... },...]}Example 1
Reference a new entity in a foreign key field parentID:
{ "entities": [{ "id": "#stringA", ... }, { "parentID": "#stringA", ... },...]}Example 2
Use a sequence with the ID “nameSeq” for generating the id:
{ "entities": [{ "id": "!nameSeq", ... },...]}Example 3
Upload files and add notes:
{ "entities": [{ "id": "#idReq", "eClass": "Request", "files": [{ "name": "myname.csv", "content": "base64encoded", "mediaType": "text/csv", "type": "AttachedFile" }], "notes": [{ "content": "Some notes from our customer", "type": "CustomerNotes" }] ... },...]}Example 3
Use same name in a new entity in a field:
{ "entities": [{ "id": "#stringA", "name": "someName", }, { "refName": "#stringA.name", ... },...]}Clone entity
Section titled “Clone entity”POST /api/entity/{eClass}/{id}
Clone existing entity.
Request
Path parameters
eClassThe entity class of the entity to cloneidThe ID of the entity to clone
Body
{ "key1": any, "key2": any, "attributes.key3": any, "attributes": { "key4": any, }, ...}Where key1, key2, etc. refers to keys of the entity to clone. The keys are overrides. E.g. if the entity has a name property, you can override it with a new value.
Notice attributes can be set both with a dot-notation and as an object. The attributes of the entity to clone are merged with the overrides.
Response
The cloned entity:
{ "id": string, "eClass": string, ...}Example 1
Clone a Sample and refer the new Sample to the cloned Sample:
- Request:
POST /api/entity/Sample/S0001
{ "name": "New Sample", "parentID": "S0001"}- Response:
{ "id": "S0002", "eClass": "Sample", "parentID": "S0001", ...}