Spring boot app for crud operations using mongodb.
Please clone and startup the app at localhost:8080. Please make sure mongoDB is up and running.
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
For other OS please follow the other setup mentioned in that page.
Basically there are 5 rest APIs for CRUD operation for cars. You can use Postman or any other rest client to validate the API responses.
Request - Make sure it is a RAW JSON
{
"licensePlate": "XYZ-10",
"seatCount": 10,
"convertible": "false",
"rating": 7,
"engineType": "VX",
"carManufacturer": {
"name": "GT"
}
}
Response -
{
"status": "OK",
"message": "Data successfully inserted"
}
Response -
[
{
"id": "5ec00a70965cac107ada9e42",
"licensePlate": "XYZ-1",
"seatCount": 6,
"convertible": false,
"rating": null,
"engineType": null,
"carManufacturer": {
"name": "GT"
}
},
{
"id": "5ec00aac965cac107ada9e43",
"licensePlate": "XYZ-2",
"seatCount": 10,
"convertible": false,
"rating": 7,
"engineType": "VX",
"carManufacturer": {
"name": "GT"
}
}
]
Response -
{
"id": "5ec00a70965cac107ada9e42",
"licensePlate": "XYZ-1",
"seatCount": 6,
"convertible": false,
"rating": null,
"engineType": null,
"carManufacturer": {
"name": "GT"
}
}
Request - Make sure it is a RAW JSON and there is a valid licensePlate number to update else API will validate it with a bad request.
{
"licensePlate": "XYZ-10",
"seatCount": 10,
"convertible": "false",
"carManufacturer": {
"name": "GT"
}
}
Response -
{
"status": "OK",
"message": "Data successfully updated"
}
Response -
{
"status": "OK",
"message": "Data successfully deleted"
}