Ordering and sorting in RESTful api

Viewed 5748

I want to allow users to choose which property they would like to sort by then choose whether to order by ascending or descending.

For example, to sort based on the title and by descending order you would make a call to the api like so:

api/blogs?sortBy=title&orderBy=desc

Is this the best way to go about doing this?

I can't find anything useful online and most posts explain that sort by and order by are basically the same thing.

What are peoples opinions on this?

1 Answers

This is a very good way of doing it.

Look at smaller retail websites, they often use Get, so people can bookmark their search and sorting.

If you want multi-column sorting, just use a separator-character.

Related