Unicat API Reference

Up - API Reference - Home


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

Requires JWT.

Search for schema items: definitions, classes, and fields.

Request

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

{
    "language": "nl",
    "filter": ["and", "", [
        ["is_committed", "is_true"],
        ["validation", "not_translated"]
    ]]
}

language is the language to search in

optional

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

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. 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

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 all schema items, you can specify the optional field names "label" or "metadata". For items of type field, you can also use "initial" or "values".

Note: the updated_on filter property is not available for schema items.

Schema-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)

label 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.

metadata is | q | has | has_not | is_true | is_false | = | != | < | <= | > | >= [metadata field, value]

is text matches the exact search phrase (not case-sensitive)
q text matches on search terms in the title, +/- modifiers are available
has list includes search value
has_not list doesn't include search value
< list item count is less than
<= list item count is less than or equal
> list item count is greater than
>= list item count is greater than or equal
is_true boolean is true
is_false boolean is false
= numeric value is
!= numeric value is not
< numeric value is less than
<= numeric value is less than or equal
> numeric value is greater than
>= numeric value is greater than or equal

The choice of operator also narrows the resulting items by type.

Specify the metadata field by (dotted) name. The value depends on the metadata field's type. You cannot search for image or fieldpicker metadata.

is_committed is_true | is_false

Only match committed items - don't include modified or new items.

not_committed is_true | is_false

Only match not-committed items - only include modified or new items.

Note: this does not include extended definitions.

type is value

is the Schema item type is either "definition", "class", or "field"

classes has value

has the class is listed in the definition

Specify the class by gid or name.

Note: only for type "definition".

fields has value

has the field is listed in the definition (directly, or indirectly via the classes) or the class

Specify the field by gid or name.

Note: only for types "definition" and "class".

childdefinitions has value

has the child definition is listed in the definition

Specify the child definition by gid or name.

Note: only for type "definition".

unit q | is value

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

Note: only for type "field".

is_localized is_true | is_false

Only match fields that support localized values.

Note: only for type "field".

is_required is_true | is_false

Only match fields that require a value.

Note: only for type "field".

field_type is value

is match fields of this type.

The field type is one of "text", "textline", "textlist", "record", "recordlist", "boolean", "number", "decimal", "image", "imagelist", "file", "filelist", "code", or "barcode".

Note: only for schema items of type "field".

Success response

Authorization: <JWT>

{
    "success": true,
    "result": {
        "schema_items": [
            {"type": "definition", "item":"96ec02b2-fb8d-4fb4-b952-fad0c4b88a74"},
            {"type": "definition", "item":"33ef3a7d-66c5-4b2f-b5c1-1913a0497040"},
            {"type": "class", "item":"05ab1fdf-35f7-4fbe-b75f-7d7e9c0dcdad"},
            {"type": "field", "item":"4c7c3261-bba4-489b-b3b6-e80278324743"},
            
        ],
        "schema_items.size": 17
    },
    "data": {
        "definitions": {
            "96ec02b2-fb8d-4fb4-b952-fad0c4b88a74": {
                
            },
            
        },
        "classes": {  },
        "fields": {  },
    }
}

result

schema_items paginated results for the query, in type, name order
schema_items.size the size of the non-paginated results for the query

schema_items is a list where each item has a type and an item key. The type is one of definition, class, or field (they're sorted in that order too). The item holds a gid that can be used together with the type to find the item in the data.

data

definitions Definition info with name, classes, fields. Unordered.
classes Class info with name, fields. Unordered.
fields Field info with name, type, options. 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
1002 Search error - internal search engine error

HTTP/1.1 422 Unprocessable entity

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