Skip to content

Create a record

POST
/data/management/v1/models/{modelKey}/records
curl --request POST \
--url https://api.ebitex.io/data/management/v1/models/example/records \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "key": "example", "name": "example", "document": "example", "rowVersion": 1, "folderId": "example" }'

Creates a record of a concrete model from its whole document. Send key (optional, kebab-case), name (for a model with no name field), document and folderId (root or a folder’s id). The document is validated against the model’s schema exactly as the Data app validates it. To create or update by your own key in one call, use the upsert.

Call it from your own server with a Data management key (Settings > Management keys in the Data app); it has no CORS policy, so a browser page cannot use it, and a key restricted to origins is refused. To read data in an application use @ebitex/data-sdk (or Ebitex.Data.Delivery) with a delivery key instead: it is cached, browser-safe where a model says so, and not metered against this key’s budget. A key has one access level, and each includes the one below: read reads models, records, record history and folders; write also creates, updates, upserts, deletes and restores records; schema also creates, changes and deletes models. A key is bound to one or more partitions. With one, every request runs in it; with several, every request except whoami must name the partition by X-Data-Partition (its id) or X-Data-Partition-Key (its key), and one that does not is 400 partition_required: the server never chooses one for you. A partition outside the key’s set is 403 partition_not_allowed, exactly as a partition that does not exist. A key cannot create or delete partitions, change folder access rules, mint or revoke keys, make a model or a field more public, or remove field values from records. Each key’s budget is 300 requests a minute across all its partitions (10 to 6,000, set when the key is made). Writes count against the organization’s plan limits exactly as a person’s do.

Key: a Data management key with write or schema access (data.management.write).

modelKey
required
string
Media typeapplication/json
object
key
required
null | string
name
required
null | string
document
required
One of:
null
rowVersion
required
null | integer | string format: uint32
/^-?(?:0|[1-9]\d*)$/
folderId
null | string
Examplegenerated
{
"key": "example",
"name": "example",
"document": "example",
"rowVersion": 1,
"folderId": "example"
}

OK

partition_required: the key is bound to several partitions and the request named none. invalid_partition: the partition header is not an id. validation_failed, or model_is_abstract.

missing_api_key or invalid_api_key: no key was sent, or it is unknown, revoked or expired.

partition_not_allowed: the named partition is not one of the key’s partitions (or does not exist). quota_exceeded: the organization has reached its plan’s record limit.

scope_denied: the key lacks this route’s scope. origin_denied or ip_denied: a browser-safe key was used from an origin or address outside its restrictions. app_not_available: Content is not enabled for the organization.

No such model.

record_key_taken: another record in the partition has that key.

document_too_large: the document is over 256 KiB.

Quota exceeded; Retry-After says how long to wait. too_many_failed_authentications: too many bad keys from this address.