Sorting

Apply sorting for list endpoints like All Documents and Document Collections. Each sorting parameter refers to one field. It is possible to provide a single or multiple sorting parameters.

Possible values for the sorting parameter are:

Lists are ordered descending by default.

Sorted query results

GET https://api.cmft.io/v1/<repoName>/<endpoint>?sorting[<fields|meta>.<fieldName>]=<direction>

Path Parameters

Headers

// Response ordered ascending by title
"data": [
    {
      "fields": {
        "title": "Roses are red"
      },
      "meta": {
        "id": "314159265358979323",
        "contentType": "poem",
        "repository": "314159265358979323",
        "revision": 1,
        "tags": [],
        "createdAt": "2018-01-01T00:00:00.000Z",
        "updatedAt": "2018-01-01T00:00:00.000Z"
      }
    },
    {
      "fields": {
        "title": "Violets are blue"
      },
      "meta": {
        "id": "314159265358979323",
        "contentType": "poem",
        "repository": "314159265358979323",
        "revision": 1,
        "tags": [],
        "createdAt": "2018-01-01T00:00:00.000Z",
        "updatedAt": "2018-01-01T00:00:00.000Z"
      }
    }
]

Field Types

Sorting can be applied for the following field types:

  • Text

  • Richtext

  • Number

  • Date & Time

  • Boolean

  • Location

  • Select

  • Color

Examples

Find some examples on the query examples page:

Last updated