Skip to content

A simple RESTful API built with Django REST Framework for managing a book collection. This project demonstrates basic CRUD operations and REST API concepts.

License

Notifications You must be signed in to change notification settings

shreyescodes/book-management-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Django Book Management API

A simple RESTful API built with Django REST Framework for managing a book collection. This project demonstrates basic CRUD operations and REST API concepts.

Features

  • Full CRUD functionality for books
  • RESTful API endpoints
  • JSON data format
  • Built with Django REST Framework

Prerequisites

  • Python 3.8+
  • Django 4.0+
  • Django REST Framework

Installation

  1. Clone the repository
git clone https://github.com/Shreyescodes/django-book-api.git
cd django-book-api
  1. Create and activate virtual environment
python -m venv venv
source venv/bin/activate  # On Windows use: venv\Scripts\activate
  1. Install dependencies
pip install django djangorestframework
  1. Run migrations
python manage.py makemigrations
python manage.py migrate
  1. Start the development server
python manage.py runserver

API Endpoints

Method Endpoint Description
GET /api/books/ List all books
POST /api/books/ Create a new book
GET /api/books/{id}/ Retrieve a book
PUT /api/books/{id}/ Update a book
DELETE /api/books/{id}/ Delete a book

Usage Example

Creating a new book:

curl -X POST http://localhost:8000/api/books/ \
    -H "Content-Type: application/json" \
    -d '{
        "title": "Django for Beginners",
        "author": "John Doe",
        "description": "A comprehensive guide to Django",
        "price": "29.99"
    }'

Project Structure

bookstore/
├── books/
│   ├── models.py      # Book model
│   ├── serializers.py # Book serializer
│   └── views.py       # BookViewSet
├── bookstore/
│   ├── settings.py    # Project settings
│   └── urls.py        # URL configurations
└── manage.py

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A simple RESTful API built with Django REST Framework for managing a book collection. This project demonstrates basic CRUD operations and REST API concepts.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages