How should a resource edit path looks like on a restful web app?
Do you know how a resource edit path should looks like on a restful web app?
Can't find any serious reference but the Ruby on Rails way that it's just a convention.
I'm not talking about the put request that is used to update the resource but the path that usually returns a form, or similar, to the user to let him create and submit the final put request that updates the resource.
An example of the previously mentioned Ruby on Rails way would be开发者_运维技巧 a get request to:
http://domain.com/resource_name/resource_id/edit
Just wondering if there's some serious reference or explanation that makes this a good approach or not.
Your question is a little vague, I think; but I'll take a stab at it.
Say you have a resource at http://example.com/planets/earth. If you want to edit something about earth, do a PUT to that URI, with the new representation you would like it to have. The same could be said for, say, a user: http://example.com/users/JamesKirk.
The important thing about REST is that the 'edit' path is not seen as a path at all, it is HTTP's methods and how they operate on your resources.
Here's a good book on the subject of restful web services: RESTful Web Services
精彩评论