GET /schema has a storage, which decides how its value is written and read. Record values are plain JSON under values, keyed by field id, on create and update, and records come back the same way.
Types
A field that names more than one type, such as
ref(company,person), takes a record id of any of them.
A name’s full_name is always first_name and last_name joined by a space. You can leave it out; if you send it, it must match, or the value is refused. Write “Jane Q. Doe” as {"first_name": "Jane Q.", "last_name": "Doe"}.
Every value is checked against its field before anything is written. A value of the wrong shape is refused with 422 and the code wrong_shape, and path points at it, such as /values/units.
Clearing a field
Sendnull in values, or name the field in unset. Both clear it:
required cannot be cleared. Clearing it is refused with 422 required.
Options
Asingle_select, a multi_select, and a string_list that lists allowed_values take only those values. Write and filter by the value, never by its label. option_labels maps each value to the label people see in the app:
"under_contract", not "Under contract". Any other value is refused with 422 not_an_option, and the error lists every value with its label.
Some fields offer different options depending on a parent record. A field with choice_overrides takes the override’s allowed_values on records whose scope_attribute holds the override’s scope_record_id.
Amounts and percents
A field’sunit and format never change how a value is written. The value is always a plain number:
- Amounts are in the field’s unit. A
USDfield holding $3.2M takes3200000. Send dollars, not cents. - A percent is a fraction. A field whose
formatispercentholds 6.25% as0.0625. Sending6.25stores 625%. - A multiple is the number itself. A field whose
formatismultipleholds 2.5x as2.5. decimalsandseparatoronly change how the app shows a number.
0.0625 from 6.25, or cents from dollars, so these mistakes are stored without a refusal. Check unit and format before writing a number.
Lists
A list field (multi_select, string_list, ref_list(...)) written under values is replaced whole. To add or remove items without replacing the rest, use list_add and list_remove on an update:
values, through unset, or through list_add and list_remove, but not through two of these.
References and links
Aref(...) field holds a record id as its value. A relation is a link between records, written under links rather than values. They are separate: setting a reference field adds no link, and adding a link sets no field. See Working with your schema.
People
Aref(user) field holds a person’s VectorShift user id, not an email or a name. People belong to the VectorShift platform, not to the ontology, so you look them up outside this API, with GET /v1/users:
id. The lookup finds the organization’s members and the people invited to it; anyone else is not found. A key with scopes needs users:read (Look up people) for it. A record’s created_by and updated_by are user ids too.
Refusals
A refused value comes back as422, with path pointing at the field:
Fix the value and send the request again under a new
Idempotency-Key. The old key keeps answering with the refusal. See Idempotency.