The request in the recipe will return all available Article nodes in the system. These can be paginated, filtered, and sorted. Each of these operations is done through query parameters, which contain an array of values.
Pagination is done by appending a page query parameter. To limit the request to 10 nodes, we would append ?page[limit]=10. To access the next set of results, we would also pass page[offset]=10.
The following is an example of returning the first and second pages of results:
http://127.0.0.1:8888/jsonapi/node/article?page[limit]=10
http://127.0.0.1:8888/jsonapi/node/article?page[offset]=10&page[limit]=10
Each request contains a links property; this will also contain the next and previous links when using a paginated result.
Filtering is done by appending a filter query parameter. The following is an example for requesting all nodes that have been promoted to the front page:
http://127.0.0.1:8888/jsonapi/node/article?filter[promoted][path]=promote&filter[promoted][value]=1&filter[promoted][operator]==
Each filter is defined by a name--in the preceding example, it is promoted. The filter then takes path, which is the field to filter on. The value and operator decide how to filter.
Sorting is the simplest operation. A sort query parameter is added. The field name value is the field to sort by, and to sort in descending order, you add a minute symbol in front of the field name. The following examples show how to sort by the nid in ascending and descending order, respectively:
http://127.0.0.1:8888/jsonapi/node/article?sort=nid
http://127.0.0.1:8888/jsonapi/node/article?sort=-nid