Passing array in GET for a REST call

前端 未结 6 1506
清歌不尽
清歌不尽 2020-12-13 16:56

I have a url to fetch appointments for a user like this:

/user/:userId/appointments

How should the url look like if I want to get appointme

6条回答
  •  失恋的感觉
    2020-12-13 17:25

    Collections are a resource so /appointments is fine as the resource.

    Collections also typically offer filters via the querystring which is essentially what users=id1,id2... is.

    So,

    /appointments?users=id1,id2 
    

    is fine as a filtered RESTful resource.

提交回复
热议问题