Up - API Reference - Home
Requires JWT
Create a definition.
You create a new definition. Before use, you must commit it - until then you can keep modifying it.
Note: you cannot add working copies of fields, classes, or child definitions. Only committed ones can be added.
POST /api/p/<project gid>/definitions/create
Authorization: Bearer <JWT>
{
"name": "chapter",
"label": {"en":"Chapter"},
}
All parameters are optional - by default you'll get an unnamed_definition
.
name
a code name for the definition - must look like a variable name, using only upper/lowercase letters, digits, and underscores, and cannot start with a digit
label
a localized label for the definition, only the specified languages are updated
classes
a list of class gids - which you should really manage with the definitions/classes api
fields
a list of field gids - which you should really manage with the definitions/fields api
titlefield
a field gid that is used for the value to represent the record
layout
the layout gid for this definition - leave this out to get a newly created definition-layout too
childdefinitions
a list of child definition gids - which you should really manage with the definitions/childdefinitions api
metadata
complete metadata dict - see metadata
Authorization: <JWT>
{
"success": true,
"result": {
"definition": "a279eaa3-efe7-4873-b4a5-64fb741c048f",
"layout": "<layout gid matching definition layout>"
},
"data": {
"definitions": {
"a279eaa3-efe7-4873-b4a5-64fb741c048f": {
…
}
},
"layouts": {
"<layout gid matching definition layout>": {
…
}
}
}
}
definition
the newly created definition.
layout
the newly created layout.
definitions
Definition info with name, classes, fields.
layouts
Layout info with hierarchy.
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