In restful application, the resource is the fundamental unit.
There are six architectural constraints which make any web service — a truly RESTful API. These constraints revolve around the resource.
One of the constraints is Uniform interface. The resource should be addressable by unique (it is assumed that it would be readable) URLs and should use appropriate HTTP verbs.
In this blog, we will see Poorly written URLs and how to re-write them so that they become well-formatted and readable URLs.
We will consider the simple expense tracker application. Please see some of the use cases below.
Poorly formatted URLs and verbs.
Please see below-mentioned Url’s exposed by the restful services that are providing the solution for above-mentioned use cases. It does not only fail to follow a well-formatted URL pattern but also they are using incorrect HTTP verbs.
The better way
Above URLs can be rewritten in the better way so that those are not only well formatted and readable but also use appropriate HTTP verb as shown below.