Unicat API Reference

Up - API Reference - Home


/api/p/<project gid>/records/create

Requires JWT.

Create a new record.

You create a new child for an existing parent. This child is the last of the children, and gets the same definition as the last child. You can fill the fields later with an update. If this is the first child for a record, it will get the first child definition of the parent, or the Base definition in no child definitions are set.

You cannot add children to linked records.

Request

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

{
    "parent": "96ec02b2-fb8d-4fb4-b952-fad0c4b88a74",
    "ordering": "87b53a4e-359d-45c7-81cb-5e1c3ef444ec",
    "language": "en",
}

parent is the parent gid for the new record and must exist.
ordering the new record is last in the ordering.

optional

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": {
        "parent": "96ec02b2-fb8d-4fb4-b952-fad0c4b88a74",
        "record": "656d4c14-3c96-41b9-b035-debf51511c45"
    },
    "data": {
        "records": {
            "656d4c14-3c96-41b9-b035-debf51511c45": {
                "gid": "656d4c14-3c96-41b9-b035-debf51511c45",
                ,
                "fields": {"en": {}},
                
            },
            "96ec02b2-fb8d-4fb4-b952-fad0c4b88a74": {}
        }
    }
}

result

record the newly created record.
parent its parent with updated childcount.

data

records Record info with hierarchy, definition, field values. Unordered.

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 - parent record doesn't exist