REST, or REpresentational State Transfer, is an architectural style for providing standards between computer systems on the web, making it easier for systems to communicate with each other.
Comprised of the best practices for creating REST endpoints.
1. REST
REST, or REpresentational State Transfer, is an architectural style for providing
standards between computer systems on the web, making it easier for systems
to communicate with each other.
We use REST primarily as a way to communicate between computer systems
on the World Wide Web with JSON.
2. REST vs HTTP
• REST is an architectural style and not the standard.
• HTTP is a protocol to transfer hyper-text.
• Provides a lot of freedom to implement various design best practices.
• Flexibility to use some other application protocol with REST
• GET, POST, PUT, DELETE
3. HATEOAS
• Hypermedia As The Engine Of Application State
• Provide specific response for a request and hypermedia links to
related endpoints and thus decouple the design
5. RESTful API
• Works on client-server architecture
• Does not maintain states between two consecutive request.
• Provides flexibility, scalability over distributed system
• Concrete is better than Abstract
6. URI Formatting
• Resources are Nouns, Not Verbs
• HTTP methods are verbs
• Singular vs Plural
• /getAllUsers
• /updateUser/{userId}
• /updateUserArticle/{articleId}
8. Status Codes
• 1XX – Informational
Communicates transfer protocol-level information.
• 2XX – Success
Indicates that the client’s request was accepted successfully.
• 3XX – Redirection
Indicates that the client must take some additional action in order to
complete their request.
• 4XX - Client Error
• 5XX – Server Error
9. Security
• Some useful resource to secure REST endpoints.
https://www.devglan.com/spring-security/spring-webflux-rest-
authentication
GET is meant to perform read a resource.
POST is used to create a new resource.
PUT is used to update an existing resource.
DELETE is for deleting an existing resource.
Here is an example of creating REST endpoints with Spring - https://www.devglan.com/spring-boot/spring-boot-angular-example