Identifications of resources

In REST, resources are the key abstraction of information so that a service can make them available to its clients. Essentially, a resource can be anything—a user, a document, an image, or even an operation. Resources must be uniquely identifiable through URIs. For example, the following URI uniquely identifies a task with ID 1:

https://api.example.com/v1/tasks/1

As you can see, in this URI, we add the version number, v1, in the URI. Some people think it is a bad practice to put version information in the resource URI. They prefer to add it in the HTTP request header. Other people think that using versioning itself is not the right thing to do when building a RESTful API. For example, Roy T. Fielding mentioned the following on Twitter (https://mobile.twitter.com/fielding/status/376835835670167552):

The reason to make a real REST API is to get evolvability … a "v1" is a middle finger to your API customers, indicating RPC/HTTP (not REST).

So, is versioning really that bad? We will discuss this in detail later.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.233.205