Skip to content

Latest commit

 

History

History
97 lines (88 loc) · 1.7 KB

README.md

File metadata and controls

97 lines (88 loc) · 1.7 KB

planetary API written in Django

A simple demo REST API written in Python's Django, managing record of planets and their satellites.

Database Schema

ERD Diagram

Available Endpoints

planetary API comes with only two endpoints /planets and /satellites to perform basic CRUD operations.

planets Endpoint

1. List all the planets

GET /planets

2. Create a single planet

POST /planets/new

Content-type: application/json
{
	"planet_name": "Earth",
	"home_star": "Sol",
	"mass": 3.254e23,
	"radius": 2164,
	"distance": 354.98e6
}

3. Get a single planet

GET /planets/{planet_id}

4. Update a single planet

PUT /planets/{planet_id}

Content-type: application/json
{
	"planet_name": "Earth",
	"home_star": "Sol",
	"mass": 3.254e23,
	"radius": 2164,
	"distance": 354.98e6
}

5. Delete a single planet

DELETE /planets/{planet_id}

satellites Endpoint

1. List all the satellites

GET /satellites

2. Create a single satellite

POST /satellites/new

Content-type: application/json
{
	"satellite_name": "Moon",
	"is_regular": true,
	"radius": 2.33e+32,
	"discovery_year": 1912,
	"planet": {planet_id}
}

3. Get a single satellite

GET /satellites/{satellite_id}

4. Update a single satellite

PUT /satellites/{satellite_id}

Content-type: application/json
{
	"satellite_name": "Moon",
	"is_regular": true,
	"radius": 2.33e+32,
	"discovery_year": 1912,
	"planet": {planet_id}
}

5. Delete a single satellite

DELETE /satellites/{satellite_id}