Unicat API Reference

Up - API Reference - Home


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

Requires JWT.

Search for file assets.

Request

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

{
    "language": "nl",
    "q": "+cms 225",
    "filter": ["type", "is", "image"]
}

language is the language to search in

optional

q is the query to perform
filter assets must match this filter
page.top (default 0) only return assets starting from the top-index (0-based).
page.size (default 10) only return this many assets.

You must provide at least one of q and filter, otherwise you'll get an empty result.

q

A set of terms to search for; they will determine the relevancy score. If you prefix a term with a + it must be present in the asset, if you prefix it with a - is must not be present.

filter

We use a filter to narrow down the results, based on field values, validation checks, and other properties. A filter supports boolean logic (AND, OR, NOT) and nesting. Read the basic workings of a filter to learn how to build complex (or simple) filters.

Shared filter properties

updated_on < | > | between [value, "days"] or [value_from, value_until]

< match assets that were updated fewer than <value> days ago
> match assets that were updated more than <value> days ago
between match assets that were updated in the <value_from> - <value_until> period.

We only support "days" for now, for the < and > operators. For the between operator we need the value_from and value_until in UNIX timestamp value (seconds since 1970).

validation any | is_empty | not_translated optional_field

any any validation failed
is_empty validation returned an empty value
not_translated validation of a localized text returned an empty value for the current language, but the same field does have a value in at least one other language

Note: an empty field is not seen as a validation failure (and isn't included in results for 'any')

For assets, you can specify an optional field name, either "title" or "description".

Asset-specific filter properties

name q | is value

q match on search terms in the name, +/- modifiers are available
is match the exact search phrase (not case-sensitive)

ext is value

is match the asset filename extension

path is | starts_with value

is match the complete path, no subfolders
starts_with match paths starting with the value

Always use a leading / for the value.

title q | is value

q match on search terms in the title, +/- modifiers are available
is match the exact search phrase (not case-sensitive)

Matches are only found for the current language.

description q | is value

q match on search terms in the description, +/- modifiers are available
is match the exact search phrase (not case-sensitive)

Matches are only found for the current language.

size = | != | < | <= | > | >= value

= file size equals the value
!= file size does not equal the value
< file size is less than the value
<= file size is less than or equal to the value
> file size is greater than the value
>= file size is greater than or equal to the value

Specify the filesize in bytes.

type is value

is the asset type is either "file" or "image"

is_deleted is_true | is_false

Deleted assets can be undeleted.

width = | != | < | <= | > | >= value

Specify the width in pixels.

For assets of type "image" only.

height = | != | < | <= | > | >= value

Specify the height in pixels.

For assets of type "image" only.

aspect_ratio = | != | < | <= | > | >= value

Specify the aspect ratio as a decimal value. A value greater than one indicates landscape orientation, one means square, and less than one says portrait.

For assets of type "image" only.

is_transparent is_true | is_false

An image can report transparency without having any actual transparent areas.

For assets of type "image" only.

is_animated is_true | is_false

An image can report animation without having an actual animation.

For assets of type "image" only.

colorspace is value

is match the image's colorspace, e.g. "cmyk" or "rgb"

For assets of type "image" only.

Success response

Authorization: <JWT>

{
    "success": true,
    "result": {
        "assets": ["96ec02b2-fb8d-4fb4-b952-fad0c4b88a74", ],
        "assets.size": 17
    },
    "data": {
        "assets": {
            "96ec02b2-fb8d-4fb4-b952-fad0c4b88a74": {
                
            },
            
        }
    }
}

result

assets paginated results for the query, in relevancy order
assets.size the size of the non-paginated results for the query

data

assets Asset info with hierarchy, type, name. 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 - can't match assets with search engine results
1002 Search error - internal search engine error

HTTP/1.1 422 Unprocessable entity

{
    "success": false,
    "result": {
        "code": 1002,
        "message": "Search error",
        "info": {}
    },
    "data": {}
}