Skip to content

Report API

This API provides functionality for users to create, view, and delete reports for reviews and retrieve review media details.


Endpoints Overview

ReportViewSet

Method Endpoint Description
POST /api/v1/review/report/add/ Create a new report.
GET /api/v1/review/report/list/ Retrieve a list of reports.
GET /api/v1/review/report/list/{id}/ Retrieve details of a report.
DELETE /api/v1/review/report/<int:pk>/ Delete a specific report.

1. Create a Report

Endpoint

  • URL: /api/v1/review/report/add/
  • Method: POST
  • Permission Required: IsAuthenticated

Description

Allows an authenticated user to create a report. The user information is automatically added based on the authenticated session.

Request Payload

{
  "review_id": 123,
  "reason": "Spam or inappropriate content"
}

Response Examples

Success

{
  "detail": "Report created successfully.",
  "report": {
    "id": 1,
    "user": 45,
    "review_id": 123,
    "reason": "Spam or inappropriate content",
    "created_at": "2024-12-06T10:00:00Z"
  }
}

Error

{
  "detail": "Authentication credentials were not provided."
}


2. List All Reports

Endpoint

  • URL: /api/v1/review/report/list/
  • Method: GET
  • Permission Required: IsAuthenticated

Description

Retrieve a list of all reports created by authenticated users.

Request Payload

This API does require any request payload.

Response Examples

Success

[
  {
    "id": 1,
    "user": 45,
    "review_id": 123,
    "reason": "Spam or inappropriate content",
    "created_at": "2024-12-06T10:00:00Z"
  },
  {
    "id": 2,
    "user": 46,
    "review_id": 124,
    "reason": "Offensive language",
    "created_at": "2024-12-05T14:45:00Z"
  }
]


3. Retrieve a Specific Report

Endpoint

  • URL: /api/v1/review/report/list/{id}/
  • Method: GET
  • Permission Required: IsAuthenticated

Description

Retrieve details of a specific report by its ID.

Request Payload

This PAI does not require any payload.

Response Examples

Success

{
  "id": 1,
  "user": 45,
  "review_id": 123,
  "reason": "Spam or inappropriate content",
  "created_at": "2024-12-06T10:00:00Z"
}


4. Delete a Report

Endpoint

  • URL: /api/v1/review/report/<int:pk>/
  • Method: DELETE
  • Permission Required: IsAuthenticated

Description

Deletes a specific report by its ID.

Request Payload

This PAI does not require any payload.

Response Examples

Success

{
  "detail": "Report deleted successfully."
}

Error

{
  "detail": "You do not have permission to delete this report."
}