Skip to content

A REST API to maintain vehicle data and to provide a complete view of vehicle details including price and address.

License

Notifications You must be signed in to change notification settings

Pomile/P02-VehiclesAPI

Repository files navigation

Vehicles API

A REST API to maintain vehicle data and to provide a complete view of vehicle details including price and address.

Features

  • REST API exploring the main HTTP verbs and features
  • Custom API Error handling using ControllerAdvice
  • Swagger API docs
  • HTTP WebClient
  • MVC Test
  • Automatic model mapping

Instructions

TODOs

  • Implement the TODOs within the CarService.java and CarController.java files
  • Add additional tests to the CarControllerTest.java file based on the TODOs
  • Implement API documentation using Swagger

Run the Code

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.

Operations

Swagger UI: http://localhost:8080/swagger-ui.html

Create a Vehicle

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
   }
}

Retrieve a Vehicle

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

Update a Vehicle

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 a Vehicle

DELETE /cars/{id}

About

A REST API to maintain vehicle data and to provide a complete view of vehicle details including price and address.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published