Start the mockup API server
npm install -g json-server
json-server --watch db.json
Start springboot application
./mvnw spring-boot:run
- get all students
curl --request GET 'https://localhost:8080/students'
- get student by id
curl --request GET 'https://localhost:8080/students/1'
- create new student
curl --request POST 'https://localhost:8080/students'
--header 'Content-Type: application/json'
-d '{
"id": 6,
"name": "Leon Leong",
"age": 17,
"address": {
"street": "Taman Bukit Bendera",
"city": "Mentakab",
"postcode": "28400"
},
"course": "Accountant"
}'
- update existing student by id
curl --request PUT 'https://localhost:8080/students/6'
--header 'Content-Type: application/json'
-d '{
"id": 6,
"name": "Leon Leong cin cin",
"age": 17,
"address": {
"street": "Taman Bukit Bendera",
"city": "Mentakab",
"postcode": "28400"
},
"course": "Accountant"
}'
- delete student by id
curl --request DELETE 'https://localhost:8080/students/6'