tags:

views:

20

answers:

1

Hi,

I wish to build up a website that follows the RESTful architecture. In my site, each user is identified by a permanent username and may manage their own settings. For the settings resource, I'm torn between two URI designs.

Option 1: /users/{username}/settings

Here is a generic settings resource URL pattern. Only the logged in user can do a GET/PUT to his/her specific settings resource. It's quite complicated though, as other user specific resources need to follow this lead. It makes admin authentications which have access to all the settings of all users (or at least part of it) simpler.

Option 2: /my/settings

The URL for the settings resource of the currently logged in user. It's much simpler programming, but the URL doesn't really specify which resource it really is. The '/my' part becomes sort of an alias to '/users/{username}'.

Almost all websites follow a similar approach as option 2. What do you guys think?

+1  A: 

Why not have both? Your /my could be just a redirect to /users/{myusername}/ This way, you can use /my in the UI, but your admin users can edit each users setting through the actual /users/{username} controller

jetru
I like this. It is definitely a best of both worlds scenario.
Darrel Miller
Is it better as a redirect? I might implement it as an alias instead, with a canonical URL specified under Content-Location header of the response.
jvliwanag