api:comments
The following includes the details of how to interface with the comment records through the API.
Record field format
- id: integer, > 0
- post_id: integer, > 0
- creator_id: integer, > 0
- updater_id: integer, > 0
- body: string
- score: integer
- is_deleted: boolean
- is_sticky: boolean
- do_not_bump_post: boolean
- created_at: timestamp
- updated_at: timestamp
Associated attributes
- creator - The user that created the topic.
- updater - The user that last updated the topic.
- post - The post that the comment is on.
Nomenclature
- Plural form: "comments"
- Used in the URL pathname
- Singular form: "comment"
- Used for write parameters (Help:API Write Requests)
- Versions: none
Actions
These are the various actions that can be done with comment records.
Index
The base URL is GET /comments.json
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
post_id
score
created_at
updated_at
- Text syntax
body
- User syntax
creator
updater
- Boolean syntax
is_deleted
is_sticky
do_not_bump_post
Special search parameters
-
post_tags_match
- The comment's post's tags match the given terms. Meta-tags not supported. -
order
- Sets the order of results. -
post_id
- Orders by post ID. -
score
- Orders by comment score. -
updated_at
- Orders by updated_at timestamp.
Note: The default order is ID descending.
Show
The base URL is GET /comments/$id.json where $id is the comment ID.
Create
The base URL is POST /comments.json
Create parameters
- Required:
post_id
body
- Optional
do_not_bump_post
- Restricted to Moderator+
is_sticky
Update
The base URL is PUT /comments/$id.json where $id is the comment ID.
Update parameters
- Optional
body
is_deleted
- Restricted to Moderator+
is_sticky
Delete
The base URL is DELETE /comments/$id.json where $id is the comment ID.
Note: This action can also be accomplished using the update comment action by setting is_deleted
to true.
Undelete
The base URL is POST /comments/$id/undelete.json where $id is the comment ID.
Note: This action can also be accomplished using the update comment action by setting is_deleted
to false.