What is best practice for renaming a resource in a RESTful way?
Let’s say my users can maintain named lists of things with the uri
http://example.org/users/{userName}/lists/{listName}
I want to give my users an API to rename a certain list. What is the preferred way?
I came up with the following so far:
- POST to to the list resource with the post-data “newname=…”
- PUT the list to the new URI and then DELETE the old URI
What is the right way to do this?
First step is fine, but I suggest you not to delete old URI, because every link to that resource will be break. instead return HTTP Code 301 “Moved Permanently”
http://en.wikipedia.org/wiki/HTTP_301