Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Drink API

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.

Features

  • List all drinks
  • Create a new drink
  • Update an existing drink
  • Delete a drink

Installation

  1. Clone the repository:
git clone https://github.com/Purityj/drinks_api_endpoint.git
cd drink
  1. Create and activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate
  1. Install the required packages
pip install -r requirements.txt
  1. Apply migrations
python manage.py migrate
  1. Run server
python manage.py runserver

API Endpoints

  • 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.

Usage

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

Browser UI Results

image

Results from running consume.py script

image

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages