Unicat API Reference

Up - API Reference - Home


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

Requires JWT.

Clone the current definition under a new name — it becomes an extended definition assigned to this record only. This is how we start a new named extended definition under a parent. To update the definition for all records using the same (base) definition, use update.

The new extended definition name must be unique among extended definitions under the same parent and variable-name compatible (letters, numbers, underscores). If name is omitted or collides, it is uniquified.

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

If you want to perform this action for all siblings that share this record's definition, use update.

Request

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

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

record the record's gid

optional

name the name for the new extended definition (unique under the parent, variable-name compatible). If omitted or colliding, uniquified.
base_definition base definition gid to use instead of the current definition's original
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 omit base_definition, fields, classes, or fieldlists, the value from the source definition is used. If you pass an empty list for fields or classes, or an empty dictionary for fieldlists, extension extras for that parameter are dropped — the clone keeps only what the base definition provides (same as update).

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

result

record the updated record
definition the new extended definition for the record.

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