RESTful API design - /users/:userId/resourceType vs. /resourceType/?user=:userId -


i'm spinning tires bit , i'm curious know others have decided on given same scenario.

to list of resourcetype user identified :userid restful api, uri pattern makes sense, if have resources addressed as:

/users/:userid/resourcetype // return list of resourcetype :userid

versus:

/resourcetype/?userid=:userid // query list of resourcetype

i keep thinking "do both" - feels impractical considering how many permutations possible complex resource models.

is 'pick 1 , move on' scenario or there 1 that's pragmatically better other , i'm not seeing it?

definitely don't both! you're making support work yourself. it's best if api provides 1 way thing.

either work. depends on how tightly resource types coupled users. if there's tight coupling, (1) fine. if you're not sure, or if loosely coupled, (2) preferable.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -