Sorting Data API results with the sort parameter
IntermediatePass a sort array in your Data API request to control the order of returned records, using fieldName and sortOrder (ascend or descend).
What you'll learn
- How to structure the sort array with fieldName and sortOrder
- How to sort by multiple fields with priority order
- The difference between ascend and descend sort orders
The Data API accepts a sort parameter — an array of sort rule objects — that controls the order in which records are returned, equivalent to setting sort criteria in a FileMaker found set.
1/3
1
Add a single sort rule
Include a "sort" key in the request body alongside "query". sortOrder accepts "ascend" or "descend" (note: not "asc"/"desc").
JSON
{
"query": [{ "Status": "Active" }],
"sort": [
{ "fieldName": "LastName", "sortOrder": "ascend" }
]
}Sign in to track your progress and pick up where you left off.
Sign in to FM Dojo