A simple demo REST API written in Java's Spring Boot, managing record of planets and their satellites.
planetary API comes with only two endpoints /planets
and /satellites
to perform basic CRUD operations.
1. List all the planets
GET /planets
2. Create a single planet
POST /planets
Content-type: application/json
{
"planetName": "Earth",
"homeStar": "Sol",
"mass": 3.254e23,
"radius": 2164,
"distance": 354.98e6
}
3. Get a single planet
GET /planets/{planet_id}
4. Get satellites of a single planet
GET /planets/{planet_id}
5. Update a single planet
PUT /planets/{planet_id}
Content-type: application/json
{
"planetName": "Earth",
"homeStar": "Sol",
"mass": 3.254e23,
"radius": 2164,
"distance": 354.98e6
}
6. Delete a single planet
DELETE /planets/{planet_id}
1. List all the satellites
GET /satellites
2. Create a single satellite
POST /satellites
Content-type: application/json
{
"satelliteName": "Moon7",
"isRegular": true,
"radius": 2.33e+32,
"discoveryYear": 1912,
"planet": "http://{host_name}/springboot/planets/{planet_id}"
}
3. Get a single satellite
GET /satellites/{satellite_id}
4. Update a single satellite
PUT /satellites/{satellite_id}
Content-type: application/json
{
"satelliteName": "Moon7",
"isRegular": true,
"radius": 2.33e+32,
"discoveryYear": 1912,
"planet": "http://{host_name}/springboot/planets/{planet_id}"
}
5. Delete a single satellite
DELETE /satellites/{satellite_id}