A REST API to maintain vehicle data and to provide a complete view of vehicle details including price and address.
- REST API exploring the main HTTP verbs and features
- Hateoas
- Custom API Error handling using
ControllerAdvice
- Swagger API docs
- HTTP WebClient
- MVC Test
- Automatic model mapping
- Implement the
TODOs
within theCarService.java
andCarController.java
files - Add additional tests to the
CarControllerTest.java
file based on theTODOs
- Implement API documentation using Swagger
To properly run this application you need to start the Orders API and the Service API first.
$ mvn clean package
$ java -jar target/vehicles-api-0.0.1-SNAPSHOT.jar
Import it in your favorite IDE as a Maven Project.
Swagger UI: http://localhost:8080/swagger-ui.html
POST
/cars
{
"condition":"USED",
"details":{
"body":"sedan",
"model":"Impala",
"manufacturer":{
"code":101,
"name":"Chevrolet"
},
"numberOfDoors":4,
"fuelType":"Gasoline",
"engine":"3.6L V6",
"mileage":32280,
"modelYear":2018,
"productionYear":2018,
"externalColor":"white"
},
"location":{
"lat":40.73061,
"lon":-73.935242
}
}
GET
/cars/{id}
This feature retrieves the Vehicle data from the database and access the Pricing Service and Boogle Maps to enrich the Vehicle information to be presented
PUT
/cars/{id}
{
"condition":"USED",
"details":{
"body":"sedan",
"model":"Impala",
"manufacturer":{
"code":101,
"name":"Chevrolet"
},
"numberOfDoors":4,
"fuelType":"Gasoline",
"engine":"3.6L V6",
"mileage":32280,
"modelYear":2018,
"productionYear":2018,
"externalColor":"white"
},
"location":{
"lat":40.73061,
"lon":-73.935242
}
}
DELETE
/cars/{id}