Skip to content
Mock APIs

Guides

Pagination & query parameters

List, search, and relation endpoints share one set of query parameters. Unknown or invalid parameters are rejected with a clear 400 error instead of being silently ignored.

Pagination

Pagination parameters
ParameterDefaultRules
limit30Integer from 1 to 100
skip0Integer, 0 or more. Skipping past the end returns an empty array.

Every list response includes metadata so you can build pagers and infinite scroll:

Response shape
{
  "users": [
    "…"
  ],
  "total": 100,
  "skip": 0,
  "limit": 2
}

To get page n (1-based) with page size s, request limit=s&skip=(n-1)*s. There are more pages while skip + limit < total.

Page 3 of products
curl 'https://test.naimulhassan.me/api/v1/products?limit=10&skip=20'

Sorting

sortBy picks a sortable field (each resource lists its own) and order is asc (default) or desc. Ties are broken by id so pagination stays stable.

Most expensive products
curl 'https://test.naimulhassan.me/api/v1/products?sortBy=price&order=desc&limit=5'

Selecting fields

select takes a comma-separated list of top-level fields. id is always included. Unknown fields return 400 INVALID_PARAMETER.

Only names and emails
curl 'https://test.naimulhassan.me/api/v1/users?select=firstName,email&limit=3'

Searchable resources expose /<resource>/search?q=term. Matching is case-insensitive and finds the term anywhere in the searchable fields. Special characters are matched literally. When nothing matches you get 200 with an empty array and total: 0. Search endpoints also accept pagination, sorting, and select.

Search recipes
curl 'https://test.naimulhassan.me/api/v1/recipes/search?q=pasta'

Filters

List endpoints accept resource-specific filters. Combine as many as you like; all of them must match.

Filters per resource
ResourceFilters
/usersrole, gender, city, minAge, maxAge
/productscategory, brand, availabilityStatus, minPrice, maxPrice, minRating
/postsuserId, tag
/commentspostId, userId
/todoscompleted, userId
/cartsuserId
/recipescuisine, difficulty, mealType, tag
/quotesauthor
Affordable smartphones
curl 'https://test.naimulhassan.me/api/v1/products?category=smartphones&maxPrice=500'

Delaying responses

Add delay=<ms> (0 to 5000) to any data, auth, or relation endpoint to simulate a slow network and test loading states. Delayed requests have a stricter rate limit. For a dedicated endpoint see /test/delay.

Wait 1.5 seconds
curl 'https://test.naimulhassan.me/api/v1/posts?limit=5&delay=1500'

Validation rules

What returns 400

  • Values outside the documented range, such as limit=0, limit=101, or skip=-1.
  • Non-numeric numbers such as limit=ten, or invalid enum values such as order=sideways.
  • Unknown parameters such as page=2, which usually indicate a typo.
  • Repeating a parameter, e.g. limit=1&limit=2.

Error messages name the offending parameter, e.g. limit must be at most 100. See Errors.