Sort parameter
How does the sort parameter work? How to sort the result set of data?
Sort
The fields to sort the result by. Separated with comma like: fielda,fieldb, default sort order is ascending. To sort descending a - <minus> is placed before the fieldname.
Input
Sort = string, field name[s]
The fields for this parameter must exist is the corresponding model
Samples
# Sample: a single field
brand
Result:
{
"data": [
{
"model": "MITO",
"brand": "ALFA ROMEO",
"vehicle_id": "0086EC4F-B7E9-4021-90D0-DDEC53B2E559"
},
{
"model": "A3",
"brand": "Audi",
"vehicle_id": "2aa6137a-8317-46cf-ba46-036816fa6a0d"
},
....
# Sample: two fields
brand,model
Result:
{
"data": [
{
"model": "A3",
"brand": "Audi",
"vehicle_id": "2aa6137a-8317-46cf-ba46-036816fa6a0d"
},
{
"model": "A6 AV.QUATTRO 3.0TDI",
"brand": "Audi",
"vehicle_id": "505EE2C6-C742-40FA-8D7B-64755D8F4017"
},
....
# Sample: two field, seconde field descending
brand,-model
Result:
{
"data": [
{
"model": "A6 AV.QUATTRO 3.0TDI",
"brand": "Audi",
"vehicle_id": "505EE2C6-C742-40FA-8D7B-64755D8F4017"
},
{
"model": "A3",
"brand": "Audi",
"vehicle_id": "2aa6137a-8317-46cf-ba46-036816fa6a0d"
},
....
Gerelateerde artikelen