api:comments
Table of Contents
- 01. Record field format
- 02. Associated attributes
- 03. Nomenclature
- 04. Index
- 05. Show
- 06. Create
- 07. Update
- 08. Delete
- 09. Undelete
- 10. See also
The following includes the details of how to interface with the comment records through the API.
Record field format
Name | Type | Details |
---|---|---|
id | integer | >0 |
post_id | integer | >0 |
body | string | |
score | integer | |
is_deleted | boolean | |
is_sticky | boolean | |
do_not_bump_post | boolean | |
creator_id | integer | >0 |
updater_id | integer | >0 |
created_at | timestamp | |
updated_at | timestamp | |
creator_ip_addr | inet | Limited to Moderator+ |
updater_ip_addr | inet | Limited to Moderator+ |
Associated attributes
Name | Type | Number | Availability | Details |
---|---|---|---|---|
creator | user | single | required | |
updater | user | single | required | |
post | post | single | required |
Nomenclature
- Plural form: "comments"
- Used in the URL pathname
- Singular form: "comment"
- Used for write parameters (Help:API Write Requests)
- Versions: none
Index
HTTP Method | GET or POST* |
Base URL | /comments.json |
Type | read request |
Description | The default order is ID descending. * Accepts POST under certain circumstances. See Help:API read requests. |
Note: group_by
as a parameter must be set to comment
, or else posts will be returned instead (e.g. group_by=comment
).
Search attributes
All of the following are standard attributes with all of their available formats and qualifiers.
- Number syntax
id
score
created_at
updated_at
- Text syntax
body
- Boolean syntax
is_deleted
is_sticky
do_not_bump_post
- Post syntax
post
- User syntax
creator
updater
Special search parameters
body_matches
- Case-insensitive wildcard searching on the body text field.order
- Sets the order of results.post_id
- Orders by post ID.score
- Orders by comment score.updated_at
- Orders by updated_at timestamp.
Show
HTTP Method | GET or POST* |
Base URL | /comments/$id.json |
Type | read request |
Description | $id is the comment ID.* Accepts POST under certain circumstances. See Help:API read requests. |
Create
HTTP Method | POST |
Base URL | /comments.json |
Type | write request |
Description |
Create parameters
- Required:
post_id
body
- Optional
do_not_bump_post
Restricted to Moderator+
- Optional
is_sticky
Update
HTTP Method | PUT/PATCH |
Base URL | /comments/$id.json |
Type | write request |
Description | $id is the comment ID. |
Update parameters
- Optional:
body
is_deleted
Restricted to Moderator+
- Optional
is_sticky
Delete
HTTP Method | DELETE |
Base URL | /comments/$id.json |
Type | write request |
Description | $id is the comment ID. |
Note: This action can also be accomplished using the update comment action by setting is_deleted
to true.
Undelete
HTTP Method | POST |
Base URL | /comments/$id/undelete.json |
Type | write request |
Description | $id is the comment ID. |
Note: This action can also be accomplished using the update comment action by setting is_deleted
to false.