- Spring Boot & H2 - Discussion
- Spring Boot & H2 - Useful Resources
- Spring Boot & H2 - Quick Guide
- Spring Boot & H2 - Unit Test Repository
- Spring Boot & H2 - Unit Test Service
- Spring Boot & H2 - Unit Test Controller
- Spring Boot & H2 - Delete Record
- Spring Boot & H2 - Update Record
- Spring Boot & H2 - Get All Records
- Spring Boot & H2 - Get Record
- Spring Boot & H2 - Add Record
- Spring Boot & H2 - H2 Console
- Spring Boot & H2 - REST APIs
- Spring Boot & H2 - Project Setup
- Spring Boot & H2 - Environment Setup
- Spring Boot & H2 - Overview
- Spring Boot & H2 - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Spring Boot & H2 - REST APIs
As in previous chapter
, we ve created the required files in spring boot project. Now create the following collection in POSTMAN to test the REST APIs.GET Get All Employees − A GET request to return all the employees.
POST Add an Employee − A POST request to create an employee.
PUT Update an Employee − A PUT request to update an existing employee.
GET An Employee − A GET request to get an employee identified by its id.
Delete An Employee − A Delete request to delete an employee identified by its id.
GET All Employees
Set the following parameters in POSTMAN.
HTTP Method − GET
URL − http://localhost:8080/emp/employees
Add an Employee
Set the following parameters in POSTMAN.
HTTP Method − POST
URL − http://localhost:8080/emp/employee
BODY − An employee JSON
{ "id": "1", "age": "35", "name": "Jupe", "email": "jupe@gmail.com" }
Update an Employee
Set the following parameters in POSTMAN.
HTTP Method − PUT
URL − http://localhost:8080/emp/employee
BODY − An employee JSON
{ "id": "1", "age": "35", "name": "Jupe", "email": "jupe.roberts@gmail.com" }
GET An Employees
Set the following parameters in POSTMAN.
HTTP Method − GET
URL - http://localhost:8080/emp/employee/1 − Where 1 is the employee id
Delete An Employees
Set the following parameters in POSTMAN.
HTTP Method − DELETE
URL - http://localhost:8080/emp/employee/1 − Where 1 is the employee id