ScrollX Tag Page

Api:Comments

0 sourcesWiki updated 12/16/2025
Browse all Api:Comments images →

About Api:Comments

Table of Contents

This page has details for how to interact with comment records through the API.

01 Record field format

[hr]

NameTypeDetails
[code]id[/code]integer>0
[code]post_id[/code]integer>0
[code]body[/code]string
[code]score[/code]integer
[code]is_deleted[/code]boolean
[code]is_sticky[/code]boolean
[code]do_not_bump_post[/code]boolean
[code]creator_id[/code]integer>0
[code]updater_id[/code]integer>0
[code]created_at[/code]timestamp
[code]updated_at[/code]timestamp

02 Associated attributes

[hr]

The following is the list of relations that can be included in the API results (see Help:Common URL Parameters for more info):

NameTypeNumberAvailabilityDetails
[code]creator[/code]usersinglerequired
[code]updater[/code]usersinglerequired
[code]post[/code]postsinglerequired

03 Index

[hr]

Returns multiple comment records.

HTTP MethodGET
Base URL[code]/comments.json[/code]
Typeread request
DescriptionThe default order is ID descending.

Note: [code]group_by[/code] as a parameter must be set to [code]comment[/code], or else posts will be returned instead (e.g. [code]group_by=comment[/code]).

Search attributes

Search parameters take the following format (see Help:Common URL Parameters for more info):

[code]

search[FIELD]=VALUE

[/code]

The following are the base fields along with their associated type. Check the syntax pages for all of the available variations.

Special search parameters

The following are additional search fields.

  • [code]is_edited[/code] - Whether a comment was edited 5 or more minutes it was created. (see Help:Boolean Syntax)

Search order

Using the search parameter [code]order[/code] with one of the following values changes the order of the results.

  • [code]id_asc[/code] - ID ascending.
  • [code]created_at[/code] - Created at descending.
  • [code]created_at_desc[/code] - Created at descending.
  • [code]created_at_asc[/code] - Created at ascending.
  • [code]post_id[/code] - Post ID descending.
  • [code]post_id_desc[/code] - Post ID descending.
  • [code]score[/code] - Post ID descending.
  • [code]score_desc[/code] - Post ID descending.
  • [code]score_asc[/code] - Post ID ascending.
  • [code]updated_at[/code] - Updated at descending.
  • [code]updated_at_desc[/code] - Updated at descending.
  • [code]updated_at_asc[/code] - Updated at ascending.
  • [code]custom[/code] - Ordered by [code]search[id][/code]. (See Help:Common URL Parameters for more info)

04 Show

[hr]

Returns a single comment record.

HTTP MethodGET
Base URL[code]/comments/$id.json[/code]
Typeread request
Description[code]$id[/code] is the comment ID.

05 Create

[hr]

Creates a single comment record.

HTTP MethodPOST
Base URL[code]/comments.json[/code]
Typewrite request

Create parameters

Comment parameters take the following format (see Help:API Write Requests for more info):

[code]

comment[FIELD]=VALUE

[/code]

  • Required:
  • [code]post_id[/code]
  • [code]body[/code]
  • Optional
  • [code]do_not_bump_post[/code]
  • [code]is_sticky[/code] (Moderator+)

06 Update

[hr]

Updates a single comment record.

HTTP MethodPUT/PATCH
Base URL[code]/comments/$id.json[/code]
Typewrite request
Description[code]$id[/code] is the comment ID.

Update parameters

  • Optional:
  • [code]body[/code]
  • [code]is_deleted[/code]
  • [code]is_sticky[/code] (Moderator+)

07 Destroy

[hr]

Deletes a single comment record.

HTTP MethodDELETE
Base URL[code]/comments/$id.json[/code]
Typewrite request
Description[code]$id[/code] is the comment ID.

Note: This action can also be accomplished using Update by setting [code]is_deleted[/code] to true.

08 Undelete

[hr]

Undeletes a single comment record.

HTTP MethodPOST
Base URL[code]/comments/$id/undelete.json[/code]
Typewrite request
Description[code]$id[/code] is the comment ID.

Note: This action can also be accomplished using Update by setting [code]is_deleted[/code] to false.

09 See also

[hr]

[hr]

Controller<https://github.com/danbooru/danbooru/blob/master/app/controllers/comments_controller.rb>
Model<https://github.com/danbooru/danbooru/blob/master/app/models/comment.rb>
Policy<https://github.com/danbooru/danbooru/blob/master/app/policies/comment_policy.rb>

Api:Comments Gallery

0 visible posts on page 1