I want to create a website that follows RESTful architecture. On my site, each user is identified by a permanent username and can manage their settings. For a settings resource, I am torn between two URI projects.
Option 1: / users / {username} / settings
Here is a generic settings resource URL pattern. Only a registered user can perform GET / PUT on their settings resource. However, this is quite complicated, as other user-specific resources should follow this example. It makes additive authentications that have access to all the settings of all users (or at least partially) easier.
Option 2: / my / settings
The URL of the settings resource for the current user. This is much simpler programming, but the URL does not indicate which resource it is. The '/ my' part becomes a kind of alias for '/ users / {username}'.
Almost all websites use a similar approach, as option 2. What do you guys think?
source
share