添加评论
开发中
POST
http://localhost:8098/api/comment
该接口受到访问请求限制,在 30 秒内最多可以请求 2 次。
请求参数
Body 参数application/json
postId
number
文章 ID
parentCommentId
number | null
父评论 ID
如果此项为 null,则代表该评论是顶层评论(没有任何父评论)。
如果此项不为 null,则代表该评论是其他评论的子评论,而该项就是父评论的 ID。
评论最多只能有两层,即一个顶层评论可以有任意个子评论,但是子评论不能再有子评论。
replyCommentId
number | null
回复评论 ID
如果此项不为 null,需要同时指定 parentCommentId。
如果你只是想回复顶层评论则无需设置此项,仅需设置 parentCommentId 即可。
此项是用于回复顶层评论下的子评论。
content
string
评论内容
>= 1 字符
site
string <uri> | null
站点地址
<= 512 字符
displayName
string
名称
<= 128 字符
email
string <email>
邮箱
<= 128 字符
示例
{
"postId": 0,
"parentCommentId": 0,
"replyCommentId": 0,
"content": "string",
"site": "http://example.com",
"displayName": "string",
"email": "user@example.com"
}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'http://localhost:8098/api/comment' \
--header 'Content-Type: application/json' \
--data-raw ''
返回响应
🟢200成功
application/json
Body
code
integer
必需
errMsg
string | null
必需
data
object | null
必需
commentId
number
评论 ID
postId
number
文章 ID
parentCommentId
number | null
父评论 ID
replyCommentId
number | null
回复评论 ID
replyDisplayName
string | null
回复的评论名称
content
string
评论内容
site
string | null
站点地址
displayName
string
名称
email
string
邮箱
createTime
number
创建时间戳
isPass
boolean
是否通过审核
children
null
子评论数组
示例
{
"code": 200,
"errMsg": null,
"data": {
"commentId": 1,
"postId": 4,
"parentCommentId": null,
"replyCommentId": null,
"replyDisplayName": null,
"content": "这是一个评论内容",
"site": null,
"displayName": "我不是罗大锤",
"email": "admin@loac.cc",
"createTime": 1725723158827,
"isPass": true,
"children": null
}
}
修改于 2025-03-09 13:54:42