A Java Springboot application that provides CRUD APIs that can read and update countries, which are stored in HashMap. The build tool is Gradle. The next iteration will store the countries in a database https://github.com/florentin-a-p/demo-springboot-database
Description | Request | Expected Response |
---|---|---|
get all countries | curl http://localhost:8080/getCountries | [{"id":1,"countryName":"Indonesia","capital":"Jakarta"},{"id":2,"countryName":"Malaysia","capital":"Kuala Lumpur"},{"id":3,"countryName":"Thailand","capital":"Bangkok"}] |
get country by id | curl http://localhost:8080/getCountries/2 | {"id":2,"countryName":"Malaysia","capital":"Kuala Lumpur"} |
delete country | curl -X DELETE http://localhost:8080/deleteCountry/1 | {"msg":"country deleted"} |
update country | curl -X PUT -d '{"id":2,"countryName":"Japan","countryCapital":"Tokyo"}' -H "Content-Type: application/json" http://localhost:8080/updateCountry | {"id":2,"countryName":"Japan","capital":"Tokyo"} |
get country by name | curl http://localhost:8080/getCountries/countryName?name=India | {"id":0,"countryName":"NONE","capital":"NONE"} |
add new country | curl -X POST -d '{"countryName":"Italy","capital":"Rome"}' -H "Content-Type: application/json" http://localhost:8080/addCountry | {"id":4,"countryName":"Italy","capital":"Rome"} |