The Five Principles you must know about REST API’s
Designing REST APIs still raises question and issues, and until now there is no common or standard way of designing a good RESTful API. There are at least five basic REST guidelines or principles. They include Resources (URIs), HTTP methods, HTTP readers, Query parameters and Status codes.
- 1- Resources (URIs)
To describe your resources, one should not use action verbs but concrete names. When it comes to naming program resources, there are three case convections that can be utilized, namely: Camel Case, Snake Case, and Spinal Case. These conventions name resources by utilizing the natural language in order to avoid exotic characters.
- 2- HTTP methods
The methods are concerned with the systematic utilization of HTTP verbs to explain actions done on resources to improve the developers’ work of managing continual CRUD operations.
- 3- HTTP headers
This provides header fields that showcase information about a request, response or object in the message body.
- 4- Query Parameters
This method emphasizes the use of paging, filtering, sorting and searching of resources.
- 5- Status Codes
Most used API status codes include OK, CREATED, NO CONTENT and NOT MODIFIED. Each has their special codes.