Filtering and Sorting

API Fundamentals

Filtering and Sorting

LCE query operations commonly accept a JSON query model. Combine common query fields with domain-specific filters to reduce response size and make result ordering predictable.

Build a query model

Common filters

Search and status

searchKey supports keyword-oriented searches where implemented. status accepts the entity states defined by the domain schema.

Identifiers

Narrow by resource

Domain query models can expose arrays such as productIds, codes, cultures or orderIds.

Relationships

Expand selectively

includes requests supported relationships or navigation data. Include only what the workflow needs.

Order

Set explicit sorting

sorting is a string field. The shared schema documents a pattern such as FieldName DESC.

Example query

{
  "tenantId": 1,
  "codes": ["en", "tr"],
  "isDefault": true,
  "searchKey": "eng",
  "pageIndex": 0,
  "pageSize": 20,
  "sorting": "name ASC"
}

This example uses fields available in the language query model. Other resources expose different filters; copy field names and value types from the selected endpoint schema.

Sorting format

ExampleIntentGuidance
name ASCSort by name in ascending order.Use only if name is supported by the operation.
created DESCReturn the most recently created records first.Useful for incremental review, but not a substitute for a documented synchronization cursor.
resourceId ASCProvide deterministic ID ordering.Replace resourceId with the real schema field, such as languageId.

Query practices

  1. Start with the smallest set of filters required by the use case.
  2. Use exact ID or code filters when they are known.
  3. Add searchKey only for endpoints that support keyword search.
  4. Request relationships through includes only when needed.
  5. Keep filters and sorting unchanged while paging through a result set.
  6. Do not assume whether multiple filters are combined with AND or OR; verify the operation behavior.
  7. Treat unsupported field names and malformed sorting expressions as client errors.