Unicat API Reference

Up - API Reference - Home


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

Requires JWT

Modify a definition.

You modify a definition using a working copy. The original is unchanged until you commit your modifications. You can also revert the changes and get the original back.

You can use save_as_new to keep this version and the original.

When you get back the working copy, it will use a working copy of the layout too.

Note: you cannot add working copies of fields, classes, or child definitions. Only committed ones can be added.

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

Request

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

{
    "definition": "<definition gid>",
    "name": "chapter",
    "label": {"nl":"Hoofdstuk"},
}

definition the gid of the definition that is modified.

optional

name a code name for the definition - 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 definition, only the specified languages are updated
classes a list of class gids - which you should really manage with the definitions/classes api
fields a list of field gids - which you should really manage with the definitions/fields api
titlefield a field gid that is used for the value to represent the record
layout the layout gid for this definition - leave this out to get a newly created definition-layout too
childdefinitions a list of child definition gids - which you should really manage with the definitions/childdefinitions api
metadata complete metadata dict - this overwrites any existing metadata, no merging - see metadata

Success response

Authorization: <JWT>

{
    "success": true,
    "result": {
        "definition": "f4e706f7-e3e2-49e5-89f3-970ee941d65a"
    },
    "data": {
        "definitions": {
            "f4e706f7-e3e2-49e5-89f3-970ee941d65a": {
                
            }
        },
        "layouts": {
            
        }
    }
}

result

definition the working-copy definition - perhaps not the same gid as the request.

data

definitions Definition info with name, classes, fields.
layouts Layout info with hierarchy, if the layout 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 - modify failed