Skip to main content

评论管理 API

评论管理相关的 API 接口。

获取评论列表

请求

GET /v1/comments
Authorization: Bearer {your_access_token}

查询参数

参数类型必填描述
article_idstring文章 ID
pageinteger页码,默认 1
page_sizeinteger每页数量,默认 20

请求示例

curl -X GET "https://api.example.com/v1/comments?article_id=article_123" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

创建评论

请求

POST /v1/comments
Authorization: Bearer {your_access_token}
Content-Type: application/json

请求参数

参数类型必填描述
article_idstring文章 ID
contentstring评论内容
parent_idstring父评论 ID(回复评论时使用)

请求示例

curl -X POST https://api.example.com/v1/comments \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"article_id": "article_123",
"content": "这是一条评论"
}'

删除评论

请求

DELETE /v1/comments/{comment_id}
Authorization: Bearer {your_access_token}

请求示例

curl -X DELETE https://api.example.com/v1/comments/comment_123 \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"