URL query string convention for multiple sort

后端 未结 3 483
醉酒成梦
醉酒成梦 2021-02-01 06:59

I have a RESTful web application that supports multiple sort fields on a collection of items. Is there a common convention for encoding these sort fields into the query string o

3条回答
  •  时光取名叫无心
    2021-02-01 07:43

    For REST, I prefer a more intuitive syntax:

    http://myapp.com/books?sort=+author,-datepublished&count=12

    And more elaborated (without '+' sign):

    http://myapp.com/books?sort=author,-datepublished&count=12

    Easy to remember...

提交回复
热议问题