Unicat API Reference

Up - API Reference - Home


/api/p/<project gid>/assets/metadata/set

Requires JWT

Add or update a metadata field for an asset.

The name should always have at least one dot (.), for grouping.

Request

POST /api/p/<project gid>/assets/metadata/set
Authorization: Bearer <JWT>

{
    "asset": "<asset gid>",
    "name": "group.code",
    "type": "textline",
    "is_localized": false,
    "value": "EC1232100921",
}

asset gid of the asset to add the metadata field to
name name for the metadata field - must look like a variable name, using only upper/lowercase letters, digits, dots, and underscores, and cannot start with a digit - must contain at least one dot, doesn't start or end with a dot, and no successive dots

optional

type (default 'textline') the metadata fields' type, see metadata
is_localized (default false) is the metadata field value different for different languages
value (default '') the metadata fields' value

If localization is set, the value should be a dictionary with all language codes as keys, e.g. {"en": "w [mm]", "nl": "b [mm]"}

If the value doesn't match the type, the value will be coerced to the type on a best-effort basis.

Success response

Authorization: <JWT>

{
    "success": true,
    "result": {
        "asset": "<asset gid>"
    },
    "data": {
        "assets": {
            "<asset gid>": {}
        }
    }
}

result

asset the asset with the added metadata field.

data

assets Asset info with hierarchy, type, name, metadata.

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