Restful API built with Java and Spring Framework.
Responses implement HAL specification (hal+json).
More information about HAL:
More information about HATEOAS:
docker-compose up
- This step IS NOT required!
You can change application port on
docker-compose.yml
file.
ports:
- 8080:8080 <- CHANGE IT HERE
Application Settings are located on
/src/main/resources
and by default a development enviroment is loaded, change it as you wish
- Add Planet - Request
{
"name": "Tatooine",
"terrain": "temperate",
"climate": "ocean"
}
Add Planet - Response
{
"id": "{planetId}",
"name": "Tatooine",
"climate": "ocean",
"terrain": "temperate",
"_links": {
"self": {
"href": "http://localhost:8080/v1/planets/{planetId}"
},
"planets": {
"href": "http://localhost:8080/v1/planets"
}
}
}
- Get Planet - Request
Get Planet - Response
{
"id": "{planetId}",
"name": "Tatooine",
"climate": "ocean",
"terrain": "temperate",
"_links": {
"self": {
"href": "http://localhost:8080/v1/planets/{planetId}"
},
"planets": {
"href": "http://localhost:8080/v1/planets"
}
},
"film_apparitions": 5
}
- Delete Planet - Request
Delete Planet - Response
{
"id": "{planetId}",
"name": "Tatooine",
"climate": "ocean",
"terrain": "temperate",
"_links": {
"planets": {
"href": "http://localhost:8080/v1/planets"
}
}
}
- Get all planets - Request
- http://localhost:8080/v1/planets
- http://localhost:8080/v1/planets?page=1&size=1 (paging)
- http://localhost:8080/v1/planets?name=tatooine (filtering by name)
Get all planets - Response
{
"_embedded": {
"items": [
{
"id": "{planetId}",
"name": "Tatooine",
"climate": "ocean",
"terrain": "temperate",
"_links": {
"self": {
"href": "http://localhost:8080/v1/planets/{planetId}"
},
"planets": {
"href": "http://localhost:8080/v1/planets"
}
},
"film_apparitions": 10
}
]
},
"_links": {
"self": {
"href": "http://localhost:8080/v1/planets?page=1&size=1"
},
"next": {
"href": "http://localhost:8080/v1/planets?page=2&size=1"
}
}
}
Tests run during CI build you can check the latest runs here
https://dev.azure.com/max-personal/starwars-challenge/_build