Unicat API Reference

Up - API Reference - Home


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

Requires JWT.

Get a worksheet with paginated children.

This endpoint is meant to power a UI where we show the current record, optional ancestor records (the path), and a scrolling list of children. The UI keeps track of the scroll position (page.top) and panel size (page.size, how many children fit in the panel) for the children. We also want to analyze the definitions used in the group and the children.

Request

You get the worksheet by specifying the gid in the record parameter.

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

{
    "record": "<record gid>",
    "ordering": "87b53a4e-359d-45c7-81cb-5e1c3ef444ec"
}

record is the main entrypoint for the worksheet.
ordering return the children in this order.

Note: channel is never used for this endpoint.

optional

language return data for this (project) language.
languages return data for these (project) languages.
page.top (default 0) only return children starting from the top-index (0-based).
page.size (default 20) only return this many children.

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.

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

{
    "record": "<record gid>",
    "ordering": "87b53a4e-359d-45c7-81cb-5e1c3ef444ec",
    "language": "nl",
    "page.top": 0,
    "page.size": 10
}

Success response

Authorization: <JWT>

{
    "success": true,
    "result": {
        "record": "f2e64fe0-9ffa-4d9a-8750-d561d6542453",
        "path": [
            "d96073b1-69da-493e-8433-3820c8cca3a8",
            "e8c7a57f-c83f-408b-b0a1-7625894dabd6",
            "4aa680cf-b43e-4769-bd09-5d298abbcac7",
            "9a7fa996-3c7f-4707-9bf7-7a251fc63ab1",
            "f2e64fe0-9ffa-4d9a-8750-d561d6542453"
        ],
        "children": [
            "96ec02b2-fb8d-4fb4-b952-fad0c4b88a74",
            "726427c2-8c72-4d2e-a09b-937a6f16d3c0",
            "98437ffb-ef37-431a-afc2-d6023e0db58c",
            "7c136ddb-4dfa-4ec1-bad4-15067cbf80d9",
            "7e52202a-90bb-430b-8ac5-e9c015da4369"
        ],
        "children.size": 5,
        "sibling_definitions": ["12a883cc-532e-403c-b9e0-505bbdb3a871"],
        "child_definitions": ["37132dcb-4c0a-464f-bb6c-66f0502b52df"]
    },
    "data": {
        "records": {
            "d96073b1-69da-493e-8433-3820c8cca3a8": {
                
            },
            
        }
    }
}

result

record the requested record.
path the path from the root to the requested record (inclusive), in tree order.
children the paginated children of the record, in ordering order.
children.size the size of the non-paginated children for the record.
sibling_definitions list of unique definitions for the siblings of the record.
child_definitions list of unique definitions for the children of the record.

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