Unicat API Reference

Up - API Reference - Home


/api/p/<project gid>/queries/add

Requires JWT.

Get one or more queries.

A query holds prepared terms and filters to perform a search.

Request

You get a query either by specifying the gid in query or queries.

If you provide both query and queries parameters 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>/queries/get
Authorization: Bearer <JWT>

{
    "query": "<query gid>"
}

or

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

{
    "queries": ["<query gid>", ]
}

query and queries are the query's gid.

Success response

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

Authorization: <JWT>

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

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

Authorization: <JWT>

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

result

query the requested query, if a single query was asked for.
queries the requested queries, if multiple queries were asked for.

data

queries Query info with type, name, q, and filter.

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