This project is a simple showcase of a REST API architecture. The API is formally defined using
an OpenAPI specification, and the Java Spring Boot interface is generated with
the openapi-generator-maven-plugin. To generate the API classes simply execute mvn compile.
This projects depends on a PostgreSQL database which can be started by executing the docker compose file provided by this repo. Start the container by prompting:
cd docker
docker compose up -dFor interacting with the API either use the provided swagger-ui or use the
commands below.
Request to get all cars from the database.
curl -u "admin:admin" http://localhost:8080/carRequest to get a specific car from the database by its id.
export CAR_ID="<car-id>"
curl -u "admin:admin" http://localhost:8080/car/$CAR_IDRequest to create a car in the database.
export CREATE_CAR='{"make": "mercedes", "model": "SL500", "mileage": 15000}'
curl -X POST -u "admin:admin" http://localhost:8080/car -H 'Content-Type: application/json' -d $CREATE_CARRequest to update a car in the database.
export UPDATE_CAR='{"id": "<car-id>","make": "mercedes","model": "A250","mileage": 15000}'
curl -X PUT -u "admin:admin" http://localhost:8080/car -H 'Content-Type: application/json' -d $UPDATE_CARRequest to delete a car in the database.
export CAR_ID="<car-id>"
curl -X DELETE -u "admin:admin" http://localhost:8080/car/$CAR_ID