Unicat API Reference

Up - API Reference - Home


/api/p/<project gid>/records/definition/layouts/modify

Requires JWT.

Modify a layout from the record's definition.

You can only change the layout if you have extended the definition.

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

Request

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

{
    "record": "<record gid>",
    "name": "new layout name"
}

record the record's gid

optional

The following are all optional, but at least one must be provided.

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

Languages are also optional, and only used for returned record data.

language return data for this (project) language.
languages return data for these (project) languages.

If you request language and/or languages, you get the records' title and fields for the combined set. If you request neither, you'll get all available languages.

Success response

Authorization: <JWT>

{
    "success": true,
    "result": {
        "record": "<record gid>",
        "definition": "<definition gid>",
        "layout": "<layout gid>"
    },
    "data": {
        "layouts": {
            "<layout gid>": {
                "gid": "<layout gid>",
                
            }
        },
        "definitions": {
            "<definition gid>": {
                "gid": "<definition gid>",
                
            }
        },
        "records": {
            "<record gid>": {
                "gid": "<record gid>",
                "definition": "<definition gid>",
                
            }
        }
    }
}

result

record the record.
definition the record's definition is (now) a working copy.
layout the layout is (now) a working copy.

data

layouts Layout info with hierarchy.
definitions Definition info with name, classes, fields.
records Record info with hierarchy, definition, field values.

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