Skip to content

Umit8098/Project_Django_Rest_Framework_Blog_App_CH-12_V.02

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📝 Blog REST API

A production-ready Blog API built with Django REST Framework featuring authentication, CRUD operations, comments, likes and nested resources.

Navigation

API Endpoints

All endpoints are RESTful and protected via token-based authentication where required.

User/Authentication Endpoints:

Method URL Explanation
POST /users/register/ New user registration
POST /users/auth/login/ User login
POST /users/auth/logout/ User logout

Blog Endpoints:

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

Comment Endpoints:

Method URL Explanation
GET /blog/comments/ List post comments
POST /blog/comments/ Add a new comment

API Testing

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:

  1. Install Postman (if not installed): Postman İndir.
  2. This Postman Collection download and import.
  3. Start testing APIs via Postman.

Postman Collection Link:
Blog App API Postman Collection

Overview

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

User Authentication Test

User/Authentication Test

➡ Testing user authentication processes with Postman.

Blog App CRUD Test

Blog CRUD Test

➡ Testing CRUD operations on the Blog App API with Postman.

Built With

This project is built with the following tools and libraries:

How To Use

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:

Example Usage

  1. Login Request:
    • URL: https://umit8114.pythonanywhere.com/users/auth/login/
    • Method: POST
    • Body (JSON):
  {
  "email": "umit@gmail.com",
  "password": "umit123456"
  }
  1. Post Create:
    • URL: https://umit8114.pythonanywhere.com/blog/posts/
    • Method: POST
    • Headers:
  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 
  }

About This Project

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

Key Features

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

Contact

Releases

No releases published

Packages

 
 
 

Contributors

Languages