Unicat API Reference

Up - API Reference - Home


/api/p/<project gid>/records/definition/update

Requires JWT.

Rename or update the extended definition (whole extension group), or create one from a base definition for all siblings that use that definition. Set its name and/or base definition, fields, classes, or fieldlists in one request. The name must be unique among extended definitions under the same parent; if it isn't, it is uniquified.

On an extended definition, updates apply to every record in the extension group.

On a base definition, update creates a new extended definition and assigns it to every non-linked sibling that currently uses that same base definition. Siblings on a different definition are left alone.

Cannot be used from a linked record; use the canonical.

If you want to perform this action for this record only, use clone.

Request

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

{
    "record": "<record gid>",
    "name": "monitorarm_v2"
}

record the record's gid

optional

name the (new) name for this extended definition (variable-name compatible; uniquified if not unique under the parent)
base_definition base definition gid (keeps added classes/fields when changing base)
fields a list of field gids - only specify the extension fields, the base fields cannot be altered here
classes a list of class gids - only specify the extension classes, the base classes cannot be altered here
fieldlists dictionary of fieldlist key → list of field gids

If you pass an empty list for fields or classes, or an empty dictionary for fieldlists, extension extras for that parameter are dropped.

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": "<extended definition gid>"
    },
    "data": {
        "definitions": {
            "<extended definition gid>": {
                "gid": "<extended definition gid>",
                "name": "monitorarm_v2",
                "is_extended": true,
                …
            }
        },
        "records": {
            "<record gid>": {
                "gid": "<record gid>",
                "definition": "<extended definition gid>",
                …
            }
        }
    }
}

result

record the updated record
definition the (same or new) extended definition for the record after the update.

data

definitions Definition info with name, classes, fields.
records Record info with hierarchy, definition, field values.
See Deferred loading of extended definitions.

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 - linked record, or invalid references