Unicat API Reference

Up - API Reference - Home


/api/p/<project gid>/classes/fields/add

Requires JWT

Add a field to a class.

If you don't specify before_field (or the specified field isn't in the class), the new field is added at the end.

Note: you cannot add working copies of fields, only committed fields can be added.

Request

POST /api/p/<project gid>/classes/fields/add
Authorization: Bearer <JWT>

{
    "class": "<class gid>",
    "field": "<field gid>",
    "before_field": "<field gid>"
}

class gid of the class to add the field to
field gid of the field that is added

optional

before_field the added field is put before this field

Success response

Authorization: <JWT>

{
    "success": true,
    "result": {
        "class": "<class gid>"
    },
    "data": {
        "classes": {
            "<class gid>": {}
        },
        "layouts": {
            
        }
    }
}

result

class the class with the added field - this is a working copy.

data

classes Class info with name, 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 - can't work with this item