Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.

A DRF-Powered REST API For Managing Streaming Platforms, Artists, Content, And User Reviews. Supports Token Auth, Filtered Endpoints, One-Review-Per-User, And Admin Control. Ready For Deployment With SQLite And Render.

License

bitsbuild/content-review-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎬 Content Review API

A fully authenticated REST API built using Django REST Framework for managing streaming platforms, artists, multimedia content, and user-submitted reviews.

This backend project supports token-based authentication, secure review submissions, and admin-level control over platform data β€” all wrapped in clean, filterable, and paginated endpoints.


🌐 Live Demo

Base URL: https://content-review.onrender.com

πŸ”’ All endpoints require a valid token, including GET requests.


✨ Features

  • πŸ” Token-based user registration and login
  • πŸŽ₯ CRUD for streaming content, artists, and platforms
  • ✍️ One-review-per-user restriction per content
  • πŸ”Ž Filtering and search on most endpoints
  • πŸ“˜ Human-readable response fields (e.g., names instead of IDs)
  • 🚦 View-specific throttling and per-action limits
  • πŸ“„ Multiple pagination strategies supported
  • βš™οΈ SQLite + WhiteNoise + Render deployment-ready setup

πŸš€ Getting Started (Local)

# Clone the repository
git clone https://github.com/bitsbuild/ContentReviewBackend.git
cd ContentReviewBackend

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Apply migrations and run the dev server
python manage.py migrate
python manage.py runserver

πŸ”‘ Authentication

This project uses Token Authentication via Django REST Framework.

πŸ“Œ All API requests must include the token in the header β€” even for GET.

How to Use Token in Postman

  1. After registration or login, copy the token
  2. In Postman, go to the Headers tab
  3. Add:
Key: Authorization
Value: Token <your_token_here>

βœ… Example:

Authorization: Token 9a14abf7d93a4112345abc...

πŸ“« API Endpoints and Usage

Base paths:

  • /api/ β†’ content, reviews, artists, platforms
  • /user/ β†’ register, login, delete

πŸ‘€ User Endpoints

πŸ”Έ Register

POST /user/create/

{
  "username": "johndoe",
  "email": "john@example.com",
  "password": "securepassword",
  "confirm_password": "securepassword"
}

Returns:

{
  "status": "Account Created Successfully",
  "token": "<your_token_here>"
}

πŸ”Έ Login (Obtain Token)

POST /user/token/

{
  "username": "johndoe",
  "password": "securepassword"
}

Returns:

{
  "token": "<your_token_here>"
}

πŸ”Έ Delete Account

POST /user/delete/ πŸ”’ Requires Token Auth

Deletes the currently authenticated user.


🎞️ Content Endpoints

As Per Latest Update Rating Based On Average Numeric Rating Of All Reviews For The Particular Piece Will Also Be Up For Display In "content_rating" Field For Content Endpoints In GET Method.

πŸ”Ή List Content

GET /api/contents/ πŸ”’ Requires Token Auth

Supports:

  • Filtering: ?artists=<id>&content_platform=<id>&content_released=true

  • Search: ?search=platform_name or ?search=artist_name

  • Pagination options:

    • Page-based: ?p=2 or ?page=2, ?size=5
    • Limit-offset: ?limit=5&start=10
    • Cursor-based: ?autopage=<cursor_string>
πŸ“˜ Sample Response:
{
  "content_name": "Inception",
  "content_platform": "Netflix",
  "artists": ["Hans Zimmer", "Leonardo DiCaprio"],
  "reviews": [...]
}

πŸ“Œ All related fields are shown as names instead of raw IDs.


πŸ”Ή Create Content

POST /api/contents/ πŸ”’ Admin Only (is_staff=True)

{
  "content_name": "Inception",
  "content_description": "Sci-fi thriller",
  "content_released": true,
  "content_platform": "<platform_id>",
  "artists": ["<artist_id_1>", "<artist_id_2>"]
}

πŸ§‘β€πŸŽ€ Artist Endpoints

GET /api/artists/ πŸ”’ Requires Token Auth πŸ”’ Write Access: Admin Only

Supports:

  • Search: ?search=zimmer
{
  "artist_name": "Hans Zimmer",
  "artist_about": "Film Composer"
}

πŸ“Ί Platform Endpoints

GET /api/platforms/ πŸ”’ Requires Token Auth πŸ”’ Write Access: Admin Only

Supports:

  • Search: ?search=netflix
{
  "platform_name": "Netflix",
  "platform_url": "https://netflix.com"
}

✍️ Review Endpoints

GET /api/reviews/ πŸ”’ Requires Token Auth

Supports:

  • Filtering: ?review_movie=<id>&review_stars=5
  • Search: ?search=Inception

πŸ“Œ Review response shows review_user and review_movie as names.


πŸ”Ή Create Review

POST /api/reviews/ πŸ”’ Requires Token Auth

{
  "review_name": "Masterpiece!",
  "review_body": "Brilliant visuals and music",
  "review_stars": 5,
  "review_movie": "<content_id>"
}

πŸ“Œ Each user can post only one review per content (enforced via DB constraint). πŸ“Œ Only the creator can update/delete their review.


πŸ” Filters & Search

Endpoint Filters Search Fields
/api/contents/ artists, content_platform, content_released artists__artist_name, content_platform__platform_name
/api/artists/ β€” artist_name, artist_about
/api/platforms/ β€” platform_name, platform_about, platform_url
/api/reviews/ review_movie, review_stars, review_user review_movie__content_name

πŸ“„ Pagination Strategies

Type Example URL Params Notes
Page Number ?page=2 or ?p=2, ?size=5 Default strategy. Supports p= alias
Limit-Offset ?limit=5&start=10 Offset-based pagination
Cursor-Based ?autopage=<cursor> Uses content_created for ordering

Max page size: 30 items Invalid page requests return a clear error message.


🚦 Throttling

Throttle behavior is enforced globally and per-view:

Scope Rate
Anonymous (anon) 30 requests/min
Authenticated (user) 60 requests/min
Content Views 60 requests/min
Platform Views 60 requests/min
Artist Views 60 requests/min
Review (list) 60 requests/min
Review (write) 10 requests/hour

These settings are managed using custom throttle classes and scoped via settings.


πŸ›‘οΈ Permissions Overview

Resource Read Access Write Access
Users (create/token/delete) Open (with throttle) πŸ”’ Delete: Token Required
Content / Platform / Artist πŸ”’ Auth Required πŸ”’ Admin Only (is_staff=True)
Reviews πŸ”’ Auth Required πŸ”’ Only creator can edit/delete

βœ… Permissions are enforced at both view and object level using DRF permissions. ❌ No anonymous access is permitted β€” not even for viewing data.


βš™οΈ Tech Stack

  • Python 3.10
  • Django 5.x
  • Django REST Framework
  • SQLite (used in both development and deployment)
  • WhiteNoise (for static file handling)
  • Render.com (deployment)
  • Postman (for API testing)

πŸͺͺ License

This project is released under the MIT License.


About

A DRF-Powered REST API For Managing Streaming Platforms, Artists, Content, And User Reviews. Supports Token Auth, Filtered Endpoints, One-Review-Per-User, And Admin Control. Ready For Deployment With SQLite And Render.

Topics

Resources

License

Stars

Watchers

Forks

Languages