Filtering
Some entities in Atlas CMS allow the user to filter the results supplying Querystring
parameters to the GET
request.
To filter results you have to supply the following Querystring parameter to the endpoint that can expect it:
filter: (optional) It can pass as many filter parameters you want based on the fields available for the Entity
The filter
parameter has a specific syntax to allow you to define the type of filters to apply.
It is composed has filter[{field}][{operator}]={value}
.
For example, the following Url filters the products
collection to get only the products that have a price
field greater than $ 10 and that belong to the Sports or Outdoor category
Filterable Entities are:
Contents
Media
Users
In the next chapters you will discover which filters can be used for each Entity type as well some examples.
Filter Operators
The available operators for filtering are the following:
eq: equals.
neq: not equals.
contains: contains.
ncontains: not contains.
starts: starts with
nstarts: not starts with.
ends: ends with.
nends: not ends with.
any: contains any. Values must be comma separated.
nany: not contains any. Values must be comma separated.
gt: greater than.
gte: greater than or equal.
lt: less than.
lte: less than or equal.
all: contains all. Values must be comma separated.
Paging & Sorting
As with filters, there are some endpoints that allow you to request paged entities.
To receive paginated results you need supply the following Querystring
parameters to the GET
request.
size: (optional) The number of entries to return per each page. If not provided the default of 25 will be used. The max value allowed is 100.
page: (optional) The number of the page to return. If not provided the default of 1 will be used.
sort: (optional) The field to use as sorterer in the form of
{field-name}|{asc|desc}
For example, the following snippet request 10 products
from the page
number 2 and sort
by the price ascending.
Good to know: when in the API References you find the querystring paramenters page, size, sort it means you can apply the pagination as we described above
Last updated