Timeline for answer to First-level resource vs required parameter in RESTful API by AilurusFulgens
Current License: CC BY-SA 3.0
Post Revisions
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 14, 2016 at 14:19 | vote | accept | Nikita Danilov | ||
| Aug 6, 2016 at 15:59 | comment | added | AilurusFulgens |
That's perfectly valid with my answer. Basically you want to avoid coupling resources in URI (token& user/:name resource). Thus your only option is to use an field in your /token resource referencing a /user/:name like an id for example (that's very similiar to foreign key in database!),. That's basically your solution 2. However, if a client want to know further information about the the user when he retrieve the resource /token, you should also include links... that's what i said in my answer :)
|
|
| Aug 6, 2016 at 8:47 | comment | added | Nikita Danilov |
We have many resources which now can be retrieved only for concrete user, as /user/:name/token. But it's just for now. In future some of this resources may take posibility to retrieve without user, as /token, for example.
|
|
| Aug 5, 2016 at 21:38 | comment | added | AilurusFulgens |
So basically you would have in the resource representation of /user/:name/token a subset of the resource representation of /token ? Because resource representation of /token contains a collection of token linked to a client ?
|
|
| Aug 5, 2016 at 21:09 | comment | added | Nikita Danilov | Thanks for interesting conception! But seems like that it does not resolve the main issue - concrete set of tokens depends on the concrete client. As example: for client "guest" token "1", for client "admin" token "2". For now - token collection can be retrieved only for concrete user. But in future this may change and will be a separate resource "token" for any users. Then it is necessary to keep the two URIs: /user/:name/token and /token. | |
| Aug 5, 2016 at 20:47 | history | answered | AilurusFulgens | CC BY-SA 3.0 |