Unicat API Reference

Up - API Reference - Home


/api/p/<project gid>/records/channels/copy_down

Requires JWT.

Copy a record's channels to its subtree.

If a list of channels isn't provided, all channels are copied down.

Processing is done as a job running in the background, it may be incomplete when you receive the response. Job progress can be queried using the returned job.token.

Note: the [all records] channel (__all__) will always stay on.

Request

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

{
    "record": "f2e64fe0-9ffa-4d9a-8750-d561d6542453",
    "channels": [
        "650ebd0f-eab5-41d7-87c1-1dc5334af872",
        "4782d5f5-b62b-4ecb-bf71-5be637a15dc5",
        "23d17876-e3cb-4acf-8eeb-a0154ca83a75"
    ]
}

record gid for the source record.

optional

channels a list of keys for the channels that must be copied; if not provided, all channels are copied down.

Success response

Authorization: <JWT>

{
    "success": true,
    "result": {
        "job.token": "06715cb7-4dfa-4ec1-bad4-c136ddbf80d9",
    },
    "data": {}
}

result

job.token the job token to look for in sync events.

Job status

Look for the job.token in sync events to find status updates on the operation. The sync event looks like this:

{
    "type": "cc",
    "cursor": <cursor>,
    "action": "UPDATE",
    "data_type": "jobs",
    "data_key": "06715cb7-4dfa-4ec1-bad4-c136ddbf80d9",
    "data": {
        "project_gid": "<project_gid>",
        "job": "copy_record_channels_down",
        "status": "processing",
        "info": {
            "total": 120,
            "remaining": 26
        },
        "created_on": 1613565541.4195538,
        "updated_on": 1613565543.2836412,
    }
}

status can be either queued, rejected, processing, or done.

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