Up - API Reference - Home
Requires JWT
Create a class.
You create a new class. Before use, you must commit it - until then you can keep modifying it.
Note: you cannot add working copies of fields, only committed fields can be added.
POST /api/p/<project gid>/classes/create
Authorization: Bearer <JWT>
{
"name": "article",
"label": {"en":"Article"},
}
All parameters are optional - by default you'll get an unnamed_class
.
name
a code name for the class - 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 class, only the specified languages are updated
fields
a list of field gids - which you should really manage with the classes/fields api
layout
the layout gid for this class - leave this out to get a newly created class-layout too
metadata
complete metadata dict - see metadata
Authorization: <JWT>
{
"success": true,
"result": {
"class": "hNOQX1EIKxaJYrBCK9qBz",
"layout": "<layout gid matching class layout>"
},
"data": {
"classes": {
"hNOQX1EIKxaJYrBCK9qBz": {
…
}
},
"layouts": {
"<layout gid matching class layout>": {
…
}
}
}
}
class
the newly created class.
layout
the newly created layout.
classes
Class info with name, 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