The RESTful style, on the other hand, is currently preferred, and there are a bunch of public APIs that use it. Common examples are companies such as GitHub and Yahoo. This style bases its functionality on the use of HTTP verbs, making it easy to understand how they work. For example, the following HTTP request makes it possible to query the repositories from GitHub:
GET https://api.github.com/users/{{GITHUB_USERNAME}}/repos
This style appeared in 2000, with Roy Fielding's doctoral dissertation that explains the REST principles and dictates how well-designed web applications should behave. The use of HTTP verbs is described in the following table:
HTTP Method/Verb | Usage |
GET |
Lists all of the resources available under the specified URI |
POST |
Creates a new resource in the specified URI |
PUT |
Replaces the existing resource under the specified URI with another one |
DELETE |
Deletes the resource specified in the URI |
PATCH |
Partially updates a resource that resides in the specified URI |