Search code examples
resturlparametersnaming-conventionsquery-string

RESTful URL style guide for searching


If one is allowed to put multiple values on single Query Parameter,

should the parameter name be in singular or plural form?

/user?status=1,2,3

vs

/user?statuses=1,2,3

I tried to google it but no one covers about this specific matter


Solution

  • As your endpoint allows a user to query for a number of statuses, then you would use the plural of status i.e.

    /user?statuses=1,2,3
    

    If your endpoint only allows a user to query for a single status you would use the singular i.e.

    /user?status=1