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:
What is the right way to do this?
What is a Resource? REST architecture treats every content as a resource. These resources can be Text Files, Html Pages, Images, Videos or Dynamic Business Data. REST Server simply provides access to resources and REST client accesses and modifies the resources. Here each resource is identified by URIs/ Global IDs.
Resources are the basic building block of a RESTful service. Examples of a resource from an online book store application include a book, an order from a store, and a collection of users. Resources are addressable by URLs and HTTP methods can perform operations on resources.
You can set the path or suffix used for a REST resource included in a REST API descriptor. By default, each REST resource in a REST API descriptor derives its path from the namespace of the REST resource. For example, if the REST resource is named myREST. myRESTResource, the path is “/myREST. myRESTResource”.
If the PUT results in the server moving the underlying resource, the ID can change.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With