This repository contains a simple Drink API built with Django and Django Rest Framework. It provides endpoints for listing, creating, updating and deleting drink items in the database. A client script is also included to demonstrate how to consume the API.
- List all drinks
- Create a new drink
- Update an existing drink
- Delete a drink
- Clone the repository:
git clone https://github.com/Purityj/drinks_api_endpoint.git
cd drink- Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate- Install the required packages
pip install -r requirements.txt- Apply migrations
python manage.py migrate- Run server
python manage.py runserver- GET /drinks: Retrieve a list of all drinks.
- POST /drinks: Create a new drink.
- GET /drinks/{id}: Retrieve a specific drink by ID.
- PUT /drinks/{id}: Update a specific drink by ID.
- DELETE /drinks/{id}: Delete a specific drink by ID.
To interact with the API, you can run the consume.py script, which demonstrates how to send HTTP requests to the API. Make sure to have the server running before executing the script.
python consume.py
