![Spring Boot & H2 Database Tutorial](/spring_boot_h2/images/spring_boot_h2_mini_logo.jpg)
- Spring Boot & H2 Tutorial
- Spring Boot & H2 - Home
- Spring Boot & H2 - Overview
- Spring Boot & H2 - Environment Setup
- Spring Boot & H2 - Project Setup
- Spring Boot & H2 - REST APIs
- Spring Boot & H2 - H2 Console
- Spring Boot & H2 Examples
- Spring Boot & H2 - Add Record
- Spring Boot & H2 - Get Record
- Spring Boot & H2 - Get All Records
- Spring Boot & H2 - Update Record
- Spring Boot & H2 - Delete Record
- Spring Boot & H2 - Unit Test Controller
- Spring Boot & H2 - Unit Test Service
- Spring Boot & H2 - Unit Test Repository
- Spring Boot & H2 Useful Resources
- Spring Boot & H2 - Quick Guide
- Spring Boot & H2 - Useful Resources
- Spring Boot & H2 - Discussion
Spring Boot & H2 - REST APIs
As in previous chapter Application Setup, we've created the required files in spring boot project. Now create the following collection in POSTMAN to test the REST APIs.
![Postman Structure](/spring_boot_h2/images/postman_structure.jpg)
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": "Julie", "email": "julie@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": "Julie", "email": "julie.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