Up - API Reference - Home
A field's definition specifies the name, type and options for a record's field value. It provides initial values and validation. A field can be included in definitions and classes.
The returned dictionary with fields uses the global identifier (gid
) as a key.
When you make changes to a field, you'll get a working copy. This is a temporary work in progress, where you make changes to a field without committing them yet (the original field is still active, and users will not see the work-in-progress changes yet). Once you're happy with the updated field, you can commit it (updating all definitions and classes that include it), or save it as a new field, that can then be used by other definitions and classes. If you're unhappy instead, you can revert it and you'll get the unmodified field again.
{
…,
"data": {
"fields": {
"99102ad0-cc00-4c50-aec6-24dfbba230e4": {
"gid": "99102ad0-cc00-4c50-aec6-24dfbba230e4",
"original": null,
"name": "description",
"label": {
"nl": "Omschrijving",
"en": "Description"
},
"type": "text",
"options": {},
"is_localized": true,
"is_required": false,
"initial": {
"nl": "",
"en": ""
},
"unit": null,
"metadata": {},
"is_new": false,
"is_working_copy": false
}
}
}
}
gid
global identifier
original
for working copies, this points to the orignal class gid
name
name to be used in code, should be variable-name compatible (letters, numbers, underscores - no dashes, spaces, punctuation)
label
a localized label
type
a types defines the sort of values you can enter, described below
options
each type has additional validation options, such as minimum value - they are described below
is_localized
should the value be localized
is_required
warn if there is no value entered for this field
initial
an initial value for the field for new records
unit
a unit like 'kg' or 'm', for numeric values
metadata
a dictionary of user-definable metadata fields, see metadata
is_new
indicates a newly created field that has never been committed.
is_working_copy
indicates a new or modified field that has not been committed.
text
generic text, line breaks are allowed
textline
a single line of text
textlist
multiple lines of text, each line has a similar meaning - think bullet points
number
an integer number
decimal
a fractional number
boolean
a toggle, yes/no value
record
a reference to another record
recordlist
multiple references to other records
image
a reference to an image asset
imagelist
multiple references to image assets
file
a reference to a file asset
filelist
multiple references to file assets
code
a text field with a special format, e.g. for json or xml data
barcode
a barcode field
fieldpicker
a field that selects a field
class
a field with nested fields from a specific class
classlist
a field with a list of items that have fields from a specific class
min
a minimum value - for number
and decimal
max
a maximum value - for number
and decimal
decimals
the number of decimal places - for decimal
min_items
a minimum number of entries - for textlist
, recordlist
, imagelist
, and filelist
max_items
a maximum number of entries - for textlist
, recordlist
, imagelist
, and filelist
min_length
a minimum number of characters - for text
and textline
max_length
a maximum number of characters - for text
and textline
values
a list of accepted values (keys, with optional labels for each locale) - for textline
and textlist
value_labels
a boolean indicating keys-only or keys-with-labels for the values
- for textline
and textlist
, where values
is set
restrict_to_values
only allow input from the list of accepted values - for textline
and textlist
, where values
is set
format
specifies the type of barcode
, we support CODE-39
, CODE-128
, DATAMATRIX
, EAN-8
, EAN-13
, I2OF5
, PDF417-TEXT
, QR
, and UPC-A
class
the class that specifies the nested fields - for class
and classlist
folder
the parent folder (asset) for upload - for image
, imagelist
, file
, and filelist
The values
option is a list of accepted values, each value has a key and labels. Labels will be set to the key if value_labels
is off. The initial
value and the record field values use the key to store the value.
{
…,
"values": [
{
"key": "orange",
"nl": "Oranje",
"en": "Orange"
},
{
"key": "yellow",
"nl": "Geel",
"en": "Yellow"
},
],
"value_labels": true,
"restrict_to_values": false
}