API Reference - Comments

Link: https://support.brilliantdirectories.com/support/solutions/articles/12000108073

← Back to API Reference | Getting Started

Comments

Comments are user-submitted responses attached to member profiles, posts, or other content. Each comment tracks its author, the content it belongs to, approval status, and a numeric rating.

Model name in URL: comments — DB table: comments

The Comments Object

FieldTypeDescription
comment_idintegerUnique comment ID (primary key, read-only)
user_idintegerID of the member who submitted the comment
parent_idintegerID of the parent comment for threaded replies (0 for top-level comments)
master_idintegerID of the top-level ancestor comment in a thread (0 for top-level comments)
post_idintegerID of the post or content item this comment is attached to
data_idintegerID of the post type (data category) for the content being commented on
comment_statusintegerApproval status: 1 = Active/approved, 2 = Waiting for approval
comment_contenttextFull text body of the comment
timestamptimestampDate and time the comment was submitted (auto-set on create)
ipstringIP address of the commenter at time of submission
ratingnumberNumeric rating submitted with the comment (0 if no rating)

List Comments Records

GET /api/v2/comments/get

Returns a paginated list of comment records.

Example Request

Copy
curl -X GET "https://www.yourdomain.com/api/v2/comments/get?limit=25" \
  -H "X-Api-Key: your-api-key-here"

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "tablesExists": true,
      "comment_id": "180",
      "user_id": "2610",
      "parent_id": "0",
      "master_id": "0",
      "post_id": "87",
      "data_id": "8",
      "comment_status": "1",
      "comment_content": "My comment",
      "timestamp": "2025-10-29 20:41:11",
      "ip": "177.93.0.224",
      "rating": "0"
    }
  ],
  "total": "1",
  "current_page": 1,
  "total_pages": 1
}

Retrieve a Comment

GET /api/v2/comments/get/{comment_id}

Example Request

Copy
curl -X GET "https://www.yourdomain.com/api/v2/comments/get/180" \
  -H "X-Api-Key: your-api-key-here"

Example Response

Copy
{
  "status": "success",
  "message": [
    {
      "tablesExists": true,
      "comment_id": "180",
      "user_id": "2610",
      "parent_id": "0",
      "master_id": "0",
      "post_id": "87",
      "data_id": "8",
      "comment_status": "1",
      "comment_content": "My comment",
      "timestamp": "2025-10-29 20:41:11",
      "ip": "177.93.0.224",
      "rating": "0"
    }
  ],
  "total": "1",
  "current_page": 1,
  "total_pages": 1
}

Create a Comment

POST /api/v2/comments/create

Example Request

Copy
curl -X POST "https://www.yourdomain.com/api/v2/comments/create" \
  -H "X-Api-Key: your-api-key-here" \
  -d "user_id=42" \
  -d "post_id=87" \
  -d "data_id=8" \
  -d "comment_content=Great+post%2C+very+helpful%21" \
  -d "comment_status=1" \
  -d "parent_id=0" \
  -d "master_id=0" \
  -d "ip=127.0.0.1" \
  -d "rating=0"

Example Response

Copy
{
  "status": "success",
  "message": {
    "comment_id": "181",
    "user_id": "42",
    "parent_id": "0",
    "master_id": "0",
    "post_id": "87",
    "data_id": "8",
    "comment_status": "1",
    "comment_content": "Great post, very helpful!",
    "timestamp": null,
    "ip": "127.0.0.1",
    "rating": "0"
  }
}

Update a Comment

PUT /api/v2/comments/update

Example Request

Copy
curl -X PUT "https://www.yourdomain.com/api/v2/comments/update" \
  -H "X-Api-Key: your-api-key-here" \
  -d "comment_id=181" \
  -d "comment_content=Updated+comment+text" \
  -d "comment_status=1"

Example Response

Copy
{
  "status": "success",
  "message": {
    "comment_id": "181",
    "user_id": "0",
    "parent_id": "0",
    "master_id": "0",
    "post_id": "0",
    "data_id": "0",
    "comment_status": "1",
    "comment_content": "Updated comment text",
    "timestamp": "2026-04-03 23:37:48",
    "ip": "",
    "rating": "0"
  }
}

Delete a Comment

DELETE /api/v2/comments/delete

Example Request

Copy
curl -X DELETE "https://www.yourdomain.com/api/v2/comments/delete" \
  -H "X-Api-Key: your-api-key-here" \
  -d "comment_id=181"

Example Response

Copy
{
  "status": "success",
  "message": "comments record was deleted"
}