Let’s say I have an app and in that app I need to view and edit “documents”. I was thinking of this URL design.
-
To pull up the default view of document with the ID “x123”:
-
To edit the same document:
-
Delete
This is more from my thinking about a document as an object in an OO point of view (e.g. “object.Action()”). Is this a bad thing? Will I run into trouble? i.e. would it be better to have #s 2 and 3 as the following?
1.
http://domain/app/edit/document-x123
2.
http://domain/app/delete/document-x123
I like http://domain/app/document-x123/edit preference.
Take livejournal:
http://jwz.livejournal.com/
http://jwz.livejournal.com/profile
http://jwz.livejournal.com/calendar
(sorry jwz now when people google you this will come up.)
Or SO:
https://stackoverflow.com/users/208990/chris-simmons
https://stackoverflow.com/users/208990?tab=activity#tab-top
Or the Twitter API:
http://apiwiki.twitter.com/Twitter-REST-API-Method:-POST-lists
(http://api.twitter.com/1/user/lists.format)
To me, URL directories go from “general” to specific. Okay I’m at stackoverflow.com. Now I’m narrowing to “users”. Now I’ve chosen a specific user. Now I’m looking at his activity.
Or “I want to access the twitter api. Now I want to move to a specific user. And now I want their lists”.
So I think your intuition is fine, and it jives with what the rest of the intertubes does!