Skip to main content

Sorting Data

Many collection operations accept the orderBy query parameter.

  • Use a field name for ascending order: orderBy=id.
  • Prefix one field with - for descending order: orderBy=-id.
GET https://api.ordering.co/v400/en/YOUR_PROJECT/orders?orderBy=-id

The shared model query validates the requested field against that model's exposed fields. When no sort is supplied, models that expose id are ordered by id ascending. An invalid shared-model sort also falls back to id ascending.

This shared behavior accepts one field, not a comma-separated sort expression. Some operations add their own ordering rules or expose a different set of sortable fields, so use the parameter description for the specific operation in API Reference.