Sorting and Paging

List and Query endpoints that return a list of entities allow you to specify sorting and paging options in the request.

This articles gives a general overview of sorting and paging. The implementation changes depending on whether an endpoint is a GET or POST request. Check your API's documentation for specific details, including which fields are sortable.

Sorting

Most APIs default to sorting by createdDate in DESC (descending) order, although some APIs have a different default sort order. You can override the default sorting by specifying a new field and order.

Sort List endpoints

List endpoints are designed to be lightweight HTTP GET requests. For this reason, sorting is applied through the query parameters, typically with sort.fieldName そして sort.order.

For example, to list contacts by last name in ascending order, append these query parameters to the request:

コピー
1

Your API's List endpoint may support sorting by multiple fields. This is done by adding a new &sort.fieldName そして &sort.order parameter for each sort field:

コピー
1

Sort クエリー endpoints

クエリー endpoints offer more robust filtering capabilities. When working with a クエリー endpoint, sorting is specified in an array in the request body, typically query.sort. For each sort object, sorting is applied with the fieldName そして order parameters.

For example, to list contacts by last name in ascending order, include this structure in the request body:

コピー
1

Paging

The standard Wix API pagination includes:

  • limit: amount of items per response (default is 0)

  • offset: number of items to skip

The following examples:

コピー
1

そして

コピー
1

Should return items 21-120 in the results.

役に立ちましたか?
はい
いいえ