Up - API Reference - Home
Requires JWT
Create a field.
You create a new field. Before use, you must commit it - until then you can keep modifying it.
POST /api/p/<project gid>/fields/create
Authorization: Bearer <JWT>
{
"name": "length_in_m",
"type": "decimal",
"is_required": false,
"unit": "m",
"label": {"en":"Length"},
}
All parameters are optional - by default you'll get an unnamed_field of type text.
name a code name for the field - must look like a variable name, using only upper/lowercase letters, digits, and underscores, and cannot start with a digit
type the fields' type
is_localized is the field value different for different languages
is_required produce a warning if the field value is empty
unit a unit for the fields' value, e.g. kg
options field options, dependent on type
label a localized label for the field, only the specified languages are updated
initial the initial value for a field - a localized field, only the specified languages are updated if is_localized is true, otherwise the value is updated for all languages - if you use values for textline and textlist fields, specify the key, not the label
metadata complete metadata dict - see metadata
See fields for information about possible types, and field options per type.
Authorization: <JWT>
{
"success": true,
"result": {
"field": "0b4c90e8-aa84-4333-a508-c30afd707b94"
},
"data": {
"fields": {
"0b4c90e8-aa84-4333-a508-c30afd707b94": {
…
}
}
}
}
field the newly created field.
fields Field info with name, type, options.
400 Bad request - missing parameters or wrong type or value
401 Unauthorized - missing or expired JWT
403 Forbidden - not a member of this project
422 Unprocessable entity - create failed