Skip to main content

Retrieve Endpoints

The retrieve endpoints allow you to fetch records from the system. There are two endpoints:

  • Find — retrieve a list of records with filtering, pagination, sorting, and field selection.
  • FindOne — retrieve a single record by its ID.

Find (List Records)

Returns a paginated list of records for a given model.

Endpoint: GET /api/{model}

Query Parameters

ParameterTypeDescription
limitnumberMaximum number of records to return (default: 10)
offsetnumberNumber of records to skip for pagination (default: 0)
fieldsstring[]Columns to include in the response (e.g. fields[0]=id&fields[1]=name)
sortstring[]Columns to sort by (prefix with - for descending, e.g. sort[0]=-createdAt)
populatestring[]Relations to load (e.g. populate[0]=department&populate[1]=roles.permissions)
populateMediastring[]Media fields whose URLs should be resolved (e.g. populateMedia[0]=avatar)
filtersobjectFilter expressions — see Filtering Data for the full syntax and operators

Example Request

GET /api/persons?limit=10&offset=0&fields[0]=id&fields[1]=name&fields[2]=email&populate[0]=department&sort[0]=name&filters[status][$eq]=active

Example Response

{
"records": [
{
"id": 1,
"name": "Jane Doe",
"email": "jane@example.com",
"department": { "id": 3, "name": "Engineering" }
}
],
"meta": {
"totalRecords": 42,
"currentPage": 1,
"totalPages": 5
}
}

FindOne (Single Record)

Returns a single record by its ID.

Endpoint: GET /api/{model}/:id

Query Parameters

ParameterTypeDescription
fieldsstring[]Columns to include in the response
populatestring[]Relations to load
populateMediastring[]Media fields whose URLs should be resolved

Example Request

GET /api/persons/12?populate[0]=department&populate[1]=manager&populateMedia[0]=avatar

Example Response

{
"id": 12,
"name": "Jane Doe",
"email": "jane@example.com",
"department": { "id": 3, "name": "Engineering" },
"manager": { "id": 5, "name": "John Smith" },
"_media": {
"avatar": [
{ "id": 7, "name": "profile.png", "_full_url": "https://storage.example.com/uploads/profile.png" }
]
}
}

Filtering

Both the Find endpoint and the backend CRUD Service find() method share the same filter syntax and operators.

For the complete operators reference, examples (simple and nested), and usage from both REST and service layers, see the Filtering Data recipe.