Change a model
const url = 'https://api.ebitex.io/data/management/v1/models/example';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","key":"example","name":"example","description":"example","parentKey":"example","isAbstract":true,"nameFieldPath":"example","exposure":"example","fields":[{"externalId":"example","name":"example","fieldTypeKey":"example","settings":{},"isMandatory":true,"isEnumerable":true,"isLocalizable":true,"isPublic":true,"queryable":{"filter":true,"sort":true,"facet":true},"defaultValue":"example"}],"rowVersion":1,"strip":{"confirmedRecords":1},"referenceTree":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.ebitex.io/data/management/v1/models/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "key": "example", "name": "example", "description": "example", "parentKey": "example", "isAbstract": true, "nameFieldPath": "example", "exposure": "example", "fields": [ { "externalId": "example", "name": "example", "fieldTypeKey": "example", "settings": {}, "isMandatory": true, "isEnumerable": true, "isLocalizable": true, "isPublic": true, "queryable": { "filter": true, "sort": true, "facet": true }, "defaultValue": "example" } ], "rowVersion": 1, "strip": { "confirmedRecords": 1 }, "referenceTree": "example" }'Replaces a model with a whole new definition, sending back the rowVersion of your last read (none is 428 row_version_required: an update never overwrites blind). A change that would leave existing records invalid answers 409 model_impact with the review (how many records, which values) and writes nothing; a person finishes it in the Data app. A key cannot make exposure or a field’s isPublic more permissive than it is; narrowing and leaving it as it is are allowed. A body that carries strip is refused: a key cannot remove values from records.
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 schema access (data.management.schema).
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
object
Examplegenerated
{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "key": "example", "name": "example", "description": "example", "parentKey": "example", "isAbstract": true, "nameFieldPath": "example", "exposure": "example", "fields": [ { "externalId": "example", "name": "example", "fieldTypeKey": "example", "settings": {}, "isMandatory": true, "isEnumerable": true, "isLocalizable": true, "isPublic": true, "queryable": { "filter": true, "sort": true, "facet": true }, "defaultValue": "example" } ], "rowVersion": 1, "strip": { "confirmedRecords": 1 }, "referenceTree": "example"}Responses
Section titled “ Responses ”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 strip_not_available: the body asks to strip values.
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).
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.
concurrency_conflict: the rowVersion is stale. model_impact: records would be left invalid. exposure_change_denied: the change makes something more public. model_taken.
row_version_required: an update without a rowVersion.
Quota exceeded; Retry-After says how long to wait. too_many_failed_authentications: too many bad keys from this address.