Timeline for Should I specify the userId in the REST URL structure?
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 4, 2019 at 21:18 | comment | added | Jbm | There is one catch when you use relative URIs (relative to the logged in user) certain scenarios become awkward to implement. Particularly when you want to let a user impersonate another, such as a support user that needs to login and see everything as another user. If he is logged in as the support user, but tries to impersonate a user he wants to help, he is going to end up looking at his own friends, not the user's he is trying to help. | |
| Feb 16, 2015 at 2:53 | comment | added | ArTs |
I would go a step further. With GET /api/friends I would rename it GET /api/myFriends. From a discoverability point of view its more self documenting. Further, with REST its useful to think about how a browser/proxy cache would handle it. With GET /api/myFriends it is entirely possible to have a bug where you display the wrong friends due to caching.
|
|
| Feb 15, 2015 at 23:17 | vote | accept | Mik378 | ||
| Feb 15, 2015 at 23:14 | comment | added | Mik378 | Neat answer, thanks. You've just confirmed what I thought ;) | |
| Feb 15, 2015 at 23:10 | history | answered | Arseni Mourzenko | CC BY-SA 3.0 |