Unicat API Reference

Up - API Reference - Home


/api/p/<project gid>/classes/layouts/modify

Requires JWT

Modify a class' layout.

You modify a layout using a working copy (of both the class and the layout).

The original is unchanged until you commit your modifications on the class - this updates the layout as well. You can also revert the changes and get the original back. You can use save_as_new to keep this version and the original.

TODO: CC-194 describe components data-structure and components.

Request

POST /api/p/<project gid>/classes/layouts/modify
Authorization: Bearer <JWT>

{
    "class": "<class gid>",
    "name": "article_layout",
}

class gid of the class that holds the layout.

optional

name a code name for the layout - should look like a variable name, all lowercase and underscores
root the gid for the root component in the components list
components a data-structure defining the layout - a list of components keyed by their gid - which you should really manage with the classes/layouts/components api

Success response

Authorization: <JWT>

{
    "success": true,
    "result": {
        "class": "<working copy gid>",
        "layout": "<layout gid>"
    },
    "data": {
        "classes": {
            "<working copy gid>": {}
        },
        "layouts": {
            "<layout gid matching working copy layout>": {}
        }
    }
}

result

class the class with the modified layout - this is a working copy
layout the layout is (now) a working copy.

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.

Error responses

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