评论

最后更新于:2021-11-29 22:50:24

Comments

结构

结构定义了评论数据中存在的所有字段。除非使用“_filter”查询参数构造字段,否则来自这些端点的任何响应都可以包含以下字段。

id

integer 
对象的唯一标识符。
只读
Context: vieweditembed
author

integer 
The ID of the user object, if author was a user.
Context: vieweditembed
author_email

string,
email
Email address for the object author.
Context: edit
author_ip

string,
ip
IP address for the object author.
Context: edit
author_name

string 
Display name for the object author.
Context: vieweditembed
author_url

string,
uri
URL for the object author.
Context: vieweditembed
author_user_agent

string 
User agent for the object author.
Context: edit
content

object 
对象的内容。
Context: vieweditembed
date

string,
datetime (details)
对象发布的日期,基于站点时区。
Context: vieweditembed
date_gmt

string,
datetime (details)
对象发布的日期,以GMT为单位。
Context: viewedit
link

string,
uri
对象的URL。
只读
Context: vieweditembed
parent

integer 
父对象的ID。
Context: vieweditembed
post

integer 
The ID of the associated post object.
Context: viewedit
status

string 
State of the object.
Context: viewedit
type

string 
Type of Comment for the object.
只读
Context: vieweditembed
author_avatar_urls

object 
Avatar URLs for the object author.
只读
Context: vieweditembed
meta

object 
元字段。
Context: viewedit

评论集合

查询此端点以检索评论集合。您收到的响应可以使用下面的URL查询参数进行控制和过滤。

定义

GET /gc/v2/comments

请求示例

$ curl https://example.com/gc-json/gc/v2/comments

参数

context提交请求的数据结构;明确响应字段结构。
默认: view
唯一: viewembededit
page集合的分页页码
默认: 1
per_page返回结果集的最大条数。
默认: 10
search字符串匹配的结果集。
afterLimit response to comments published after a given ISO8601 compliant date.
authorLimit result set to comments assigned to specific user IDs. Requires authorization.
author_excludeEnsure result set excludes comments assigned to specific user IDs. Requires authorization.
author_emailLimit result set to that from a specific author email. Requires authorization.
beforeLimit response to comments published before a given ISO8601 compliant date.
exclude确保结果集排除特定ID。
include将结果集限制为特定ID。
offset将结果集偏移特定数量的项。
order排序属性升序或降序。
默认: desc
唯一: ascdesc
orderby按对象属性对集合排序。
默认: date_gmt
唯一: datedate_gmtidincludepostparenttype
parentLimit result set to comments of specific parent IDs.
parent_excludeEnsure result set excludes specific parent IDs.
postLimit result set to comments assigned to specific post IDs.
statusLimit result set to comments assigned a specific status. Requires authorization.
默认: approve
typeLimit result set to comments assigned a specific type. Requires authorization.
默认: comment
password文章的密码(如果有密码保护)。

创建评论

参数

authorThe ID of the user object, if author was a user.
author_emailEmail address for the object author.
author_ipIP address for the object author.
author_nameDisplay name for the object author.
author_urlURL for the object author.
author_user_agentUser agent for the object author.
content对象的内容。
date对象发布的日期,基于站点时区。
date_gmt对象发布的日期,以GMT为单位。
parent父对象的ID。
postThe ID of the associated post object.
statusState of the object.
meta元字段。

定义

POST /gc/v2/comments

检索评论

定义 & 请求示例

GET /gc/v2/comments/<id>

查询此端点以检索特定的评论数据。

$ curl https://example.com/gc-json/gc/v2/comments/<id>

参数

id对象的唯一标识符。
context提交请求的数据结构;明确响应字段结构。
默认: view
唯一: viewembededit
passwordThe password for the parent post of the comment (if the post is password protected).

修改评论

参数

id对象的唯一标识符。
authorThe ID of the user object, if author was a user.
author_emailEmail address for the object author.
author_ipIP address for the object author.
author_nameDisplay name for the object author.
author_urlURL for the object author.
author_user_agentUser agent for the object author.
content对象的内容。
date对象发布的日期,基于站点时区。
date_gmt对象发布的日期,以GMT为单位。
parent父对象的ID。
postThe ID of the associated post object.
statusState of the object.
meta元字段。

定义

POST /gc/v2/comments/<id>

请求示例

删除评论

参数

id对象的唯一标识符。
force是否绕过垃圾箱并强制删除。
passwordThe password for the parent post of the comment (if the post is password protected).

定义

DELETE /gc/v2/comments/<id>

请求示例

$ curl -X DELETE https://example.com/gc-json/gc/v2/comments/<id>