Unicat API Reference

Up - API Reference - Home


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

Requires JWT

Modify a definition' layout.

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

The original is unchanged until you commit your modifications on the definition - 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.

Note: you cannot modify an extended definition (use the records/definition api).

Request

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

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

definition gid of the definition 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 definitions/layouts/components api

Success response

Authorization: <JWT>

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

result

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

data

definitions Definition info with name, classes, fields, and layout, also includes the original definition 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