Up - API Reference - Home
Requires JWT
Modify a field.
You modify a field using a working copy. The original is unchanged until you commit
your modifications. You can also revert
the changes and get the original back.
You can use save_as_new
to keep this version and the original.
POST /api/p/<project gid>/fields/modify
Authorization: Bearer <JWT>
{
"field": "<field gid>",
"name": "length_in_m",
"type": "decimal",
"is_required": false,
"unit": "m",
"label": {"en":"Length"},
}
field
the gid of the field that is modified
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 - this overwrites any existing metadata, no merging - see metadata
See fields
for information about possible types, and field options per type.
Authorization: <JWT>
{
"success": true,
"result": {
"field": "a1cded00-192f-4077-8895-60021ca084b3"
},
"data": {
"fields": {
"a1cded00-192f-4077-8895-60021ca084b3": {
…
}
}
}
}
field
the working-copy field - perhaps not the same gid
as the request.
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 - modify failed