Unicat API Reference

Up - API Reference - Home


/api/p/<project gid>/records/fields/preview

Requires JWT.

Generate a preview for a record field's value.

A high resolution preview is generated. You use DAM transforms on the resulting file to get appropriately resized versions.

The following previews are supported, all for fields of type barcode:

Request

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

{
    "record": "96ec02b2-fb8d-4fb4-b952-fad0c4b88a74",
    "field": "baacaffa-56f2-4d3b-8888-5fbf12b46f2e"
}

record gid for the record
field gid for the field

optional

language if you want to use the field's value and the field is localized, you must specify the language
value generate a preview for a different value than is in the record's field

Success response

Authorization: <JWT>

{
    "success": true,
    "result": {
        "preview_pathname": "/preview/96ec02b2-fb8d-4fb4-b952-fad0c4b88a74/baacaffa-56f2-4d3b-8888-5fbf12b46f2e.6d7a68ef.png",
        "timing_ms": {
            "generate": 7
        }
    },
    "data": {}
}

result

preview_pathname the pathname you can use to ask the DAM for a version of the preview - see the DAM transform documentation
timing_ms the time it took to generate the preview, in milliseconds

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 generate a preview for this field's value