Like the specified comment, increase the number of likes of the comment, and return the updated comment information.
Points to note
- The API uses the POST method and requires data to be submitted in application/ format
- Provide a valid comment ID.
- Each IP or user may have limitations to prevent liking spams
- Ensure that the domain address is correctly configured
- After liking successfully, the updated comment information and like count will be returned
Request address
{域名地址}/api/comment/praise
Description:{域名地址}Replace it with your domain name, such ashttps://en.anqicms.com/api/comment/praise
Request Syntax
POST /api/comment/praise
Content-Type: application/json
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 | Is | Comment ID |
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 |
Usage Example
Request example
POST /api/comment/praise HTTP/1.1
Host: www.anqicms.com
Content-Type: application/json
{
"id": 33
}
Response Example
{
"code": 0,
"data": {
"id": 33,
"created_time": 1662734920,
"updated_time": 1662735286,
"archive_id": 140,
"user_id": 0,
"user_name": "anqicms",
"ip": "127.0.0.1",
"vote_count": 2,
"content": "欢迎使用anqicms",
"parent_id": 0,
"to_uid": 0,
"status": 0,
"item_title": "欢迎使用AnqiCMS",
"parent": null,
"active": true
},
"msg": "点赞成功"
}
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 |