A REST service built on Java, Spring Boot and H2 database.
https://odemur-spring-boot-rest.herokuapp.com/person
- Language: Java
- Framework: Spring Boot
- Build Automation Tool: Apache Maven
- Database: H2
- Service API: REST
Clone this project and running on you local machine.
Only for development and testing purposes.
- Java SDK 17
- Java IDE
Please follow carefully step by step instructions below:
git clone https://github.com/odemur/spring-boot-rest-service.git
- Open this project folder with any Java IDE (IntelliJ IDEA, Eclipse, etc..)
- Run the application using the IDE > Run Option
To test API Endpoint is necessary an HTTP Client Tool.
I recommed the app Postman [https://www.postman.com/downloads]
Create a new Person from JSON structure.
-
Endpoint
/person
-
Method
POST
-
Body Data (application/json)
{ "firstName": "John", "lastName": "Doe", "email": "[email protected]" }
-
Response
-
Code: 201
Content:{ "id": 1, "firstName": "John", "lastName": "Doe", "email": "[email protected]" }
-
Returns JSON list of all persons data.
-
Endpoint
/person
-
Method
GET
-
Response
-
Code: 200
Content:
[{ "id": 1, "firstName": "John", "lastName": "Doe", "email": "[email protected]" }, { "..." }]
-
Returns JSON of a specific person by ID.
-
Endpoint
/person/:id
-
URL Params
Required
id=[integer]
-
Method
GET
-
Response
-
Code: 200
Content:
{ "id": 1, "firstName": "John", "lastName": "Doe", "email": "[email protected]" }
-
Update person with the values sent as JSON.
Returns an updated JSON structure.
-
Endpoint
/person/:id
-
Method
PUT
-
URL Params
Required:
id=[integer]
-
Body Data (application/json)
{ "firstName": "Mary", "lastName": "Jane", "email": "[email protected]" }
-
Success Response
-
Code: 200
Content:
{ "id": 1, "firstName": "Mary", "lastName": "Jane", "email": "[email protected]" }
-
Delete person by ID.
-
Endpoint
/person/:id
-
Method:
DELETE
-
URL Params
Required:
id=[integer]
-
Success Response:
- Code: 200
- Code: 200