Get Comment List Interface

Get website comment list data, support filtering by document ID, pagination display and other functions, returning detailed comment information.

Points to note

  • This interface is used to retrieve the comment list information of the website
  • Supports filtering specific document comments by document ID
  • Supports custom sorting methods
  • Supports paginated display of comment data
  • Ensure that the domain address is correctly configured
  • Only return reviewed comments (status=1) unless special permission is granted

Request address

{域名地址}/api/comment/list

Description:{域名地址}Replace it with your domain name, such ashttps://en.anqicms.com/api/comment/list

Request Syntax

GET /api/comment/list

Request Headers

This interface involves only public request headers. For more information, please refer toCommon Request Headers (Common Request Headers).

Request parameters

Field name Type Required Description
id int No Document ID, specified document ID
order string No Comment sorting, defaultid desc
page int No Get the specified page content, default: 1
limit int No Display the number, 'limit' can specify the number of items to display, pagination by how many items, for example, if 'limit="10

Response header

This interface only involves common response headers. For more information, please refer toCommon Request Headers (Common Request Headers).

Return parameters

Field name Type Description
code int Error code
msg string Error description
data object[] result content

data result item parameter

Field name Type Description
id int Comment ID
parent_id int Parent Comment ID
archive_id int Document ID
user_name string Comment username
user_id int Comment user ID
IP string Commenter IP
Vote count int like count
content string category content details
created_time int publish timestamp
updated_time int update timestamp
status int review status, 1 reviewed, 0 in review

Usage Example

Request example

GET /api/comment/list?id=71&page=1&limit=10 HTTP/1.1
Host: www.anqicms.com

Response Example

{
  "code": 0,
  "data": [
    {
      "id": 1,
      "created_time": 1624494644,
      "updated_time": 1626076192,
      "archive_id": 71,
      "user_id": 0,
      "user_name": "crown",
      "ip": "127.0.0.1",
      "vote_count": 0,
      "content": "欢迎使用AnqiCMS",
      "parent_id": 0,
      "to_uid": 0,
      "status": 1,
      "item_title": "",
      "parent": null,
      "active": false
    },
    {
      "id": 2,
      "created_time": 1624070973,
      "updated_time": 1635423845,
      "archive_id": 71,
      "user_id": 0,
      "user_name": "Memory",
      "ip": "127.0.0.1",
      "vote_count": 225,
      "content": "博客系统很棒",
      "parent_id": 1,
      "to_uid": 0,
      "status": 1,
      "item_title": "",
      "parent": null,
      "active": false
    }
  ],
  "msg": "",
  "total": 4
}

error code

Error code Description
0 OK
-1 Error, the reason is indicated in msg
1001 Not logged in
1002 Not authorized
200 API request OK