Unicat API Reference

Up - API Reference - Home


/api/p/<project gid>/assets/get

Requires JWT.

Get one or more assets.

An asset has folder and file data and metadata. Assets form a tree through their pathname property. Each asset has a global id (gid) to uniquely identify it.

The assets/get endpoint always orders by treestructure and name.

Request

You get an asset either by specifying the gid in asset or assets, or by giving a pathname or pathnames parameter.

The pathname is enough to specify a single asset, just as a gid can, but when you move or rename an asset its pathname changes, but its gid will not.

If you provide both asset and assets parameters, or e.g. assets, and pathname, then we use parameter matching to guess what you meant. The first action that matches the parameters is performed, the rest is ignored. Parameter matching happens in the order given below:

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

{
    "asset": "<asset gid>"
}

or

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

{
    "assets": ["<asset gid>", ]
}

or

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

{
    "pathname": "/products"
}

or

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

{
    "pathnames": ["/products/image.jpg", "/files/doc.pdf"]
}

asset and assets are the asset's gid.

pathname and pathnames are complete paths (including the name).

Success response

If you request a single asset, you'll get a single asset.

Authorization: <JWT>

{
    "success": true,
    "result": {
        "asset": "96ec02b2-fb8d-4fb4-b952-fad0c4b88a74"
    },
    "data": {
        "assets": {
            "96ec02b2-fb8d-4fb4-b952-fad0c4b88a74": {
                
            },
            
        }
    }
}

If you requested multiple assets, you'll get a list of assets.

Authorization: <JWT>

{
    "success": true,
    "result": {
        "assets": [
            "96ec02b2-fb8d-4fb4-b952-fad0c4b88a74",
            "7c136ddb-4dfa-4ec1-bad4-15067cbf80d9",
            "726427c2-8c72-4d2e-a09b-937a6f16d3c0"
        ]
    },
    "data": {
        "assets": {
            "96ec02b2-fb8d-4fb4-b952-fad0c4b88a74": {
                
            },
            
        }
    }
}

result

asset the requested asset, if a single asset was asked for.
assets the requested assets, if multiple assets were asked for.

Whether you requested the assets by asset or by pathname, the response is the same.

data

assets Asset info with hierarchy, type, name.

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