UmweltDocs
Reference/Commands/entity.create
entity.createcommandsince 0.1

Creates an entity of a declared type: a character, a group, a place, an object.

Request
umwelt call story.umw entity.create '{
  "projectId": "ball",
  "id": "ana",
  "typeId": "person",
  "name": "Ana"
}'
Request
const result = await client.entityCreate({ projectId: 'ball', id: 'ana', typeId: 'person', name: 'Ana' });
Request
var result = engine.EntityCreate(new CreateEntityInput
{
    ProjectId = "ball",
    Id = "ana",
    TypeId = "person",
    Name = "Ana",
});
Response
{
  "id": "ana",
  "projectId": "ball",
  "name": "Ana",
  "aliases": [],
  "typeId": "person",
  "archived": false,
  "createdAt": { "tick": 0 },
  "fields": {}
}

Payload

FieldTypeDescription
projectIdrequiredstringThe project to write to.
idstringIts id. Generated when absent.
typeIdrequiredstringIts entity type.
namerequiredstringIts name.
aliasesstring[]default []Other names it goes by.
createdAtPositiondefault {"tick":0}The position it exists from.
externalRefExternalRefThe id another system gives it: { system, id }, unique per project.
fieldsobjectdefault {}Values for the fields its type declares, validated against them.

Result

FieldTypeDescription
idalwaysstringThe entity’s id, given or generated.
projectIdalwaysstringThe project it belongs to.
typeIdalwaysstringIts entity type, which decides whether it can hold knowledge.
namealwaysstringIts name.
aliasesstring[]Other names it goes by.
fieldsobjectValues for the fields its type declares.
externalRefExternalRefThe id another system gives it: { system, id }.
createdAtalwaysPositionThe position it exists from. Defaults to { "tick": 0 }.
archivedalwaysbooleanSet by entity.archive. It changes nothing else.

Rules

The type decides what it can hold. An entity of an agent or group type can hold knowledge; one of an other type can only be talked about.

Errors

VALIDATION_FAILEDThe payload is malformed, or a field does not fit its type.
NOT_FOUNDThe project or the entity type does not exist.
CONFLICTAn entity with that id exists, or the external reference already belongs to another entity.
HANDSHAKE_REQUIREDOver the protocol, hello was not sent first.

Every code is listed in Errors.

See also

Was this page helpful?