Skip to content

Entity

{{include:includes/entity/_get-entities.md}}

{{include:includes/entity/_get-entity.md}}

POST /api/entity

Create new entities or update existing entities.

Request

Body

{
"entities": [{
"id": string,
"eClass": string,
...
},...]
}
  • entities The entities to create or update. The eClass is required. If id is set and is found in the database, an existing entity will be updated with the given property values.

Functional notation:

  • # Used for referencing an id, name, or barcode variable. The variable will be replaced with auto-generated IDs by backend, or the alias it refers to.
  • # in conjunction with ., e.g. #idReq.name refers to the name of a entity with id #idReq.
  • ! Used for switching eClass prefix. Can only be used on id variables. 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.
  • input for Step: StepInput associated records are created based on this.

Default values:

The following properties have defaults:

  • name: fallback to ID
  • userID: fallback to currently logged in user
  • departmentID: fallback to currently logged in user’s department
  • status: Initial, unless datamodel states differently
  • type: 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",
...
},...]
}

POST /api/entity/{eClass}/{id}

Clone existing entity.

Request

Path parameters

  • eClass The entity class of the entity to clone
  • id The 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",
...
}