评论
最后更新于:2021-11-29 22:50:24
Comments
结构
结构定义了评论数据中存在的所有字段。除非使用“_filter”查询参数构造字段,否则来自这些端点的任何响应都可以包含以下字段。
id integer | 对象的唯一标识符。 只读 Context: view , edit , embed |
author integer | The ID of the user object, if author was a user. Context: view , edit , embed |
author_email string, | 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: view , edit , embed |
author_url string, uri | URL for the object author. Context: view , edit , embed |
author_user_agent string | User agent for the object author. Context: edit |
content object | 对象的内容。 Context: view , edit , embed |
date string, datetime (details) | 对象发布的日期,基于站点时区。 Context: view , edit , embed |
date_gmt string, datetime (details) | 对象发布的日期,以GMT为单位。 Context: view , edit |
link string, uri | 对象的URL。 只读 Context: view , edit , embed |
parent integer | 父对象的ID。 Context: view , edit , embed |
post integer | The ID of the associated post object. Context: view , edit |
status string | State of the object. Context: view , edit |
type string | Type of Comment for the object. 只读 Context: view , edit , embed |
author_avatar_urls object | Avatar URLs for the object author. 只读 Context: view , edit , embed |
meta object | 元字段。 Context: view , edit |
评论集合
查询此端点以检索评论集合。您收到的响应可以使用下面的URL查询参数进行控制和过滤。
定义
GET /gc/v2/comments
请求示例
$ curl https://example.com/gc-json/gc/v2/comments
参数
context | 提交请求的数据结构;明确响应字段结构。 默认: view 唯一: view , embed , edit |
page | 集合的分页页码 默认: 1 |
per_page | 返回结果集的最大条数。 默认: 10 |
search | 字符串匹配的结果集。 |
after | Limit response to comments published after a given ISO8601 compliant date. |
author | Limit result set to comments assigned to specific user IDs. Requires authorization. |
author_exclude | Ensure result set excludes comments assigned to specific user IDs. Requires authorization. |
author_email | Limit result set to that from a specific author email. Requires authorization. |
before | Limit response to comments published before a given ISO8601 compliant date. |
exclude | 确保结果集排除特定ID。 |
include | 将结果集限制为特定ID。 |
offset | 将结果集偏移特定数量的项。 |
order | 排序属性升序或降序。 默认: desc 唯一: asc , desc |
orderby | 按对象属性对集合排序。 默认: date_gmt 唯一: date , date_gmt , id , include , post , parent , type |
parent | Limit result set to comments of specific parent IDs. |
parent_exclude | Ensure result set excludes specific parent IDs. |
post | Limit result set to comments assigned to specific post IDs. |
status | Limit result set to comments assigned a specific status. Requires authorization. 默认: approve |
type | Limit result set to comments assigned a specific type. Requires authorization. 默认: comment |
password | 文章的密码(如果有密码保护)。 |
创建评论
参数
author | The ID of the user object, if author was a user. |
author_email | Email address for the object author. |
author_ip | IP address for the object author. |
author_name | Display name for the object author. |
author_url | URL for the object author. |
author_user_agent | User agent for the object author. |
content | 对象的内容。 |
date | 对象发布的日期,基于站点时区。 |
date_gmt | 对象发布的日期,以GMT为单位。 |
parent | 父对象的ID。 |
post | The ID of the associated post object. |
status | State 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 唯一: view , embed , edit |
password | The password for the parent post of the comment (if the post is password protected). |
修改评论
参数
id | 对象的唯一标识符。 |
author | The ID of the user object, if author was a user. |
author_email | Email address for the object author. |
author_ip | IP address for the object author. |
author_name | Display name for the object author. |
author_url | URL for the object author. |
author_user_agent | User agent for the object author. |
content | 对象的内容。 |
date | 对象发布的日期,基于站点时区。 |
date_gmt | 对象发布的日期,以GMT为单位。 |
parent | 父对象的ID。 |
post | The ID of the associated post object. |
status | State of the object. |
meta | 元字段。 |
定义
POST /gc/v2/comments/<id>
请求示例
删除评论
参数
id | 对象的唯一标识符。 |
force | 是否绕过垃圾箱并强制删除。 |
password | The 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>