Sorting

All sorting related parameters begin with order. Not all endpoints support changing the sort. This is decided on an endpoint by endpoint basis, so check each endpoint for what’s allowed. Some may allow changing the sort direction only, or which properties to sort out, both, or neither.

Let’s say you’re fetching a list of entities (which supports changing the sort), you may change the default sort using orderBy; e.g orderBy=title. The value can be comma-separated; e.g. orderBy=title,name. Sometimes it may be properties in related entities; e.g. orderBy=title,companyAddress. When sorting is supported, you can’t just sort by any arbitrary property you like. Again, check the endpoint document which will list what’s supported exactly.

The sort direction can be changed by using orderMode; e.g. orderMode=ASC or orderMode=DESC.

Feedback

If you have any feedback or suggestions, feel free to contact us at api@teamwork.com.