A production-ready Blog API built with Django REST Framework featuring authentication, CRUD operations, comments, likes and nested resources.
All endpoints are RESTful and protected via token-based authentication where required.
| Method | URL | Explanation |
|---|---|---|
| POST | /users/register/ |
New user registration |
| POST | /users/auth/login/ |
User login |
| POST | /users/auth/logout/ |
User logout |
| Method | URL | Explanation |
|---|---|---|
| GET | /blog/posts/ |
List all posts |
| POST | /blog/posts/ |
Create a new post |
| GET | /blog/posts/14/ |
Specific post details |
| PUT | /blog/posts/14/ |
Post update |
| DELETE | /blog/posts/16/ |
Post delete |
| Method | URL | Explanation |
|---|---|---|
| GET | /blog/comments/ |
List post comments |
| POST | /blog/comments/ |
Add a new comment |
Postman Collection contains the necessary requests to test each endpoint of your API. You can use it to quickly understand the functionality of the API.
To test APIs via Postman, you can follow the steps below:
- Install Postman (if not installed): Postman İndir.
- This Postman Collection download and import.
- Start testing APIs via Postman.
Postman Collection Link:
Blog App API Postman Collection
The Blog API application allows users to create blogs, comment, and interact with other users. This application provides:
- Token-based authentication & authorization
- Blog & Comment CRUD operations
- Like system
- Nested resources using drf-nested-routers
➡ Testing user authentication processes with Postman.
➡ Testing CRUD operations on the Blog App API with Postman.
This project is built with the following tools and libraries:
- Django Rest Framework - A powerful framework for developing REST APIs.
- dj-rest-auth - User authentication and authorization.
- drf-nested-routers - Hierarchical routing.
To clone and run this application, you'll need Git
When installing the required packages in the requirements.txt file, review the package differences for windows/macOS/Linux environments.
Complete the installation by uncommenting the appropriate package.
# Clone this repository
$ git clone https://github.com/Umit8098/Project_Django_Rest_Framework_Blog_App_CH-12_V.02.git
# Install dependencies
$ python -m venv env
$ python3 -m venv env (for macOs/linux OS)
$ env/Scripts/activate (for win OS)
$ source env/bin/activate (for macOs/linux OS)
$ pip install -r requirements.txt
$ python manage.py migrate (for win OS)
$ python3 manage.py migrate (for macOs/linux OS)
# Create and Edit .env
# Add Your SECRET_KEY in .env file
"""
# example .env;
SECRET_KEY =123456789abcdefg...
"""
# Run the app
$ python manage.py runserver- After cloning the app and installing the dependencies, you can follow these steps:
- Login Request:
- URL:
https://umit8114.pythonanywhere.com/users/auth/login/ - Method:
POST - Body (JSON):
- URL:
{
"email": "umit@gmail.com",
"password": "umit123456"
}- Post Create:
- URL:
https://umit8114.pythonanywhere.com/blog/posts/ - Method:
POST - Headers:
- URL:
Authorization: Token <token key returned when logged in>
-
- Body (JSON):
{
"title": "fifth Post",
"content": "Second Content",
"image": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Sport_balls.svg/400px-Sport_balls.svg.png",
"is_published": true
}- This is an API service for a blog application built with Django Rest Framework.
- Users can register, write blogs, comment on blogs and like them.
- Blog Management: Users can write, update and delete blogs.
- Comment and Like: Can comment and add likes to blogs.
- User Authorization: User registration, login and profile management.
- Hierarchical Data Structure: Advanced data management with drf-nested-routers.
-
GitHub: @Umit8098
-
LinkedIn: @umit-arat

