https://github.com/ankman007/books-api-drf
A simple RESTful API built with DRF to manage a collection of books. It supports full CRUD operations along with filtering and pagination.
https://github.com/ankman007/books-api-drf
django-filter django-rest-framework sqlite swagger-ui
Last synced: 2 months ago
JSON representation
A simple RESTful API built with DRF to manage a collection of books. It supports full CRUD operations along with filtering and pagination.
- Host: GitHub
- URL: https://github.com/ankman007/books-api-drf
- Owner: ankman007
- Created: 2025-07-26T15:57:45.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-07-29T06:36:43.000Z (11 months ago)
- Last Synced: 2025-07-29T08:46:18.556Z (11 months ago)
- Topics: django-filter, django-rest-framework, sqlite, swagger-ui
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Project Description
A simple RESTful API built with Django REST Framework to manage a collection of books. It supports full CRUD operations along with filtering and pagination.
🔗 [Medium Article: Building a Simple REST API with DRF](https://medium.com/@ankitpoudel_/build-a-simple-rest-api-with-django-rest-framework-a-step-by-step-guide-bc996201d248)
## Tech Stack
- Django REST Framework
- SQLite
- django-filter (for filtering)
- Swagger (for documentation)
## API Endpoints
- books/
Handles GET (list books with filtering and pagination) and POST (create new book).
- books//
Handles GET (retrieve), PUT (update), PATCH (partial update), and DELETE (remove) a specific book by ID.
## Filtering & Pagination
- Case-insensitive filtering on `title` and `author`
- Example:
`/books/?author=ankit&page=2`
- Pagination is enabled by DRF's `PageNumberPagination`:
```
{
"count": 6,
"next": "http://localhost:8000/books/?page=2",
"previous": null,
"results": [
{ "title": "Good Book", ... },
...
]
}
```
## Project Setup Guide
1. cd into project directory
2. Create a new .env file by copying the env.example file
3. Open the .env file and update it with your credentials as needed
4. Install dependencies `pip install -r requirements.txt`
5. Run migrations `python manage.py migrate`
6. Start the server `python manage.py runserver`