Up - API Reference - Home
Requires JWT
Add a new component to a class' layout.
If the parent component doesn't exist or doesn't accept children, you'll get an error.
If you don't specify before_component
(or the specified component isn't in the layout or a child of the given parent), the new component is added at the end.
POST /api/p/<project gid>/classes/layouts/components/create
Authorization: Bearer <JWT>
{
"class": "<class gid>",
"name": "optional component name",
"type": "field",
"options": {"field": "<field gid>", "style": "title"},
"parent": "<component gid>",
"before_component": "<component gid>"
}
class
gid of the class to update the layout for
parent
add the created component to this parent
type
the type of component
name
the name of the component
options
some types need extra options
before_component
the created component is put before this component
See
layouts
for types and options for components
Authorization: <JWT>
{
"success": true,
"result": {
"class": "<class gid>",
"layout": "<layout gid>",
"component": "<new component gid>"
},
"data": {
"classes": {
"<class gid>": {…}
},
"layouts": {
…
}
}
}
class
the class with the changed layout - this is a working copy.
layout
the layout is (now) a working copy.
component
the newly created component's gid - you can find it in the components property of the layout data.
classes
Class info with name, fields, and layout, also includes the original class if it changed to a working copy.
layouts
Layout info with hierarchy, also includes the original layout if it changed to a working copy.
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 - can't work with this item