For a better experience, please view this file using a markdown viewer.
This project aims to retrieve data from an external source, store it in an appropriate database structure, and create a CRUD RESTful API to interact with the database.
It uses Django Rest Framework to create the API including the CRUD endpoints.
- Retrieve data from the GraphQL endpoint:
https://swapi-graphql.netlify.app/.netlify/functions/index
using a Modular Query Methodology.
You can visualize the data shape here. - Store the obtained data from the GraphQL endpoint into the database and create appropriate models.
- Write RESTful Create, Read, Update, and Delete endpoints to interact with the database.
- Poetry is used to manage the dependencies.
- Run
poetry install
to install the dependencies.
- Run
poetry shell
to activate the virtual environment. - Run
python manage.py runserver
to start the server. - Open:
- http://127.0.0.1:8000/api/ in your browser to view the API.
- http://127.0.0.1:8000/api/reset_data/ in your browser to reset the data in the database. Every time this endpoint is called, all records in the database are permanently deleted and recreated with the information from SWAPI.
- http://127.0.0.1:8000/admin/ in your browser to view the admin panel.
(Runpython manage.py createsuperuser
to create a superuser.)
All endpoints are prefixed with /api/
. All endpoints adhere to the RESTful API format.
List of endpoints:
- List Endpoint (GET) - Retrieve a list of all instances of the model.
- example:
GET /api/planet/
- example:
- Detail Endpoint (GET) - Retrieve details of a specific instance of the model.
- example:
GET /api/planet/{pk}
- example:
- Create Endpoint (POST) - Create a new instance of the model.
- example:
POST /api/planet/
- example:
- Update Endpoint (PUT) - Update a specific instance of the model using a complete representation.
- example:
PUT /api/planet/{pk}
- example:
- Partial Update Endpoint (PATCH) - Update a specific instance of the model using a partial representation.
- example:
PATCH /api/planet/{pk}
- example:
- Delete Endpoint (DELETE) - Delete a specific instance of the model.
- example:
DELETE /api/planet/{pk}
- example:
- Python 3.11.3
- Django 4.2.4
- Django REST Framework @latest
- Poetry 1.4.2
- SQLite
- django_mysql
- Authentication and Authorization.
- Testing.
- Deployment.
- Frontend.
- Dockerization.
- CI/CD.
- Documentation.
- Logging.
- Caching.
- Rate Limiting.
- Filtering.
- Versioning.
- Monitoring.
- Security.
- Performance. (partially done)
- Scalability.