Skip to content

Latest commit

 

History

History
55 lines (47 loc) · 1.21 KB

File metadata and controls

55 lines (47 loc) · 1.21 KB

Threaded-Comments-API-Server

Comment Thread API Server using Django and DRF

Functionalities

  • Get all the comments and their respective replies on a page
  • Add a comment or a reply (sub comment)
  • Edit a comment or a reply
  • Delete a comment or the whole thread. (The whole thread gets deleted if the parent comment is deleted)

Technologies used

  • Framework: Django
  • Rest API: Django Rest Framework
  • database: PostgresSql

Endpoint for different functionalities

  • Create a new comment:
# input
{ 
    "comment_body": "hello",
    "is_sub_comment": 0,  # Boolean (Only True when comment is a reply)
    "parent_id": -1    # if the comment itself is the parent, set parent_id = -1

}
  • Add a reply:
# input
{ 
    "comment_body": "hello",
    "is_sub_comment": 1,
    "parent_id": 3  # the ID of the parent comment

}
# input
{
 "comment_id": 5,
 "comment_body": "hello2",
}
# input
{
  "comment_id": 5
}