Skip to content

Query

The query endpoint supports rich filtering, sorting, and pagination in a single POST request.

http
POST /api/{entity}/query
Content-Type: application/json

Request Body

json
{
  "paginationData": {
    "page": 0,
    "size": 10
  },
  "sort": ["name;asc", "price;desc"],
  "queryCriteriaList": [
    {
      "field": "status",
      "value": "IN_STOCK",
      "operator": "EQ"
    }
  ]
}

All fields are optional:

FieldTypeDescription
paginationDataObjectPagination config. If omitted, all matching records are returned without a size limit.
paginationData.pageintPage index, 0-based (min: 0)
paginationData.sizeintRecords per page (min: 1)
sortstring[]Sort expressions in field;direction format (asc or desc). Multiple values apply in order.
queryCriteriaListarrayList of filter criteria. All criteria are combined with AND logic.

Sort format

Sort values use a semicolon separator: "name;asc", "price;desc".

Filter Criteria

Each entry in queryCriteriaList has:

FieldRequiredDescription
operatorYesThe comparison operator (see table below)
fieldDependsThe entity field to filter on. Required for all operators except GLOBAL.
valueDependsThe value to compare against. Not required for NULL, NOT_NULL, EMPTY, NOT_EMPTY.
columnsOnly for GLOBALList of field names to search across (global full-text search).

Operators

OperatorDescriptionValue type
EQEqualsscalar
NENot equalsscalar
GTGreater thanscalar
GEGreater than or equalscalar
LTLess thanscalar
LELess than or equalscalar
STARTS_WITHString starts withstring
ENDS_WITHString ends withstring
CONTAINSString containsstring
NOT_CONTAINSString does not containstring
INValue is in listarray
NOT_INValue is not in listarray
CONTAINS_ANYCollection contains any ofarray
CONTAINS_ALLCollection contains all ofarray
CONTAINS_NONECollection contains none ofarray
NULLField is null
NOT_NULLField is not null
EMPTYCollection/string is empty
NOT_EMPTYCollection/string is not empty
GLOBALFull-text search across multiple columnsstring (use columns to specify fields)

Examples

Filter by status with pagination

json
{
  "paginationData": { "page": 0, "size": 20 },
  "sort": ["name;asc"],
  "queryCriteriaList": [
    { "field": "status", "value": "IN_STOCK", "operator": "EQ" }
  ]
}

Filter by price range

json
{
  "queryCriteriaList": [
    { "field": "price", "value": 50, "operator": "GE" },
    { "field": "price", "value": 200, "operator": "LE" }
  ]
}

Filter by a list of IDs

json
{
  "queryCriteriaList": [
    { "field": "reference", "value": ["AB-001", "AB-002", "AB-003"], "operator": "IN" }
  ]
}

Global search across multiple fields

json
{
  "paginationData": { "page": 0, "size": 10 },
  "queryCriteriaList": [
    {
      "operator": "GLOBAL",
      "value": "headphones",
      "columns": ["name", "description", "category.name"]
    }
  ]
}

Records with no category assigned

json
{
  "queryCriteriaList": [
    { "field": "category", "operator": "NULL" }
  ]
}

Response

200 OK — a Spring Page with matching records:

json
{
  "content": [
    {
      "reference": "AB-001",
      "name": "Headphones",
      "price": 199.99,
      "category": { "id": 1, "name": "Electronics" },
      "status": "IN_STOCK"
    }
  ],
  "totalElements": 1,
  "totalPages": 1,
  "size": 10,
  "number": 0
}

If paginationData is omitted, totalPages is 1, size equals totalElements, and all results are in content.

Access Control

Requires the read authority for the entity. See RBAC.