ScrollX Tag Page

Api:Comments

0 posts0 sourcesWiki updated 12/16/2025
Browse Full Gallery →

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]

[table]

[thead]

[tr]

[th]Name[/th]

[th]Type[/th]

[th]Details[/th]

[/tr]

[/thead]

[tbody]

[tr]

[td][code]id[/code][/td]

[td]integer[/td]

[td]>0[/td]

[/tr]

[tr]

[td][code]post_id[/code][/td]

[td]integer[/td]

[td]>0[/td]

[/tr]

[tr]

[td][code]body[/code][/td]

[td]string[/td]

[td][/td]

[/tr]

[tr]

[td][code]score[/code][/td]

[td]integer[/td]

[td][/td]

[/tr]

[tr]

[td][code]is_deleted[/code][/td]

[td]boolean[/td]

[td][/td]

[/tr]

[tr]

[td][code]is_sticky[/code][/td]

[td]boolean[/td]

[td][/td]

[/tr]

[tr]

[td][code]do_not_bump_post[/code][/td]

[td]boolean[/td]

[td][/td]

[/tr]

[tr]

[td][code]creator_id[/code][/td]

[td]integer[/td]

[td]>0[/td]

[/tr]

[tr]

[td][code]updater_id[/code][/td]

[td]integer[/td]

[td]>0[/td]

[/tr]

[tr]

[td][code]created_at[/code][/td]

[td]timestamp[/td]

[td][/td]

[/tr]

[tr]

[td][code]updated_at[/code][/td]

[td]timestamp[/td]

[td][/td]

[/tr]

[/tbody]

[/table]

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):

[table]

[thead]

[tr]

[th]Name[/th]

[th]Type[/th]

[th]Number[/th]

[th]Availability[/th]

[th]Details[/th]

[/tr]

[/thead]

[tbody]

[tr]

[td][code]creator[/code][/td]

[td]user[/td]

[td]single[/td]

[td]required[/td]

[td][/td]

[/tr]

[tr]

[td][code]updater[/code][/td]

[td]user[/td]

[td]single[/td]

[td]required[/td]

[td][/td]

[/tr]

[tr]

[td][code]post[/code][/td]

[td]post[/td]

[td]single[/td]

[td]required[/td]

[td][/td]

[/tr]

[/tbody]

[/table]

03 Index

[hr]

Returns multiple comment records.

[table]

[tbody]

[tr]

[td]HTTP Method[/td]

[td]GET[/td]

[/tr]

[tr]

[td]Base URL[/td]

[td][code]/comments.json[/code][/td]

[/tr]

[tr]

[td]Type[/td]

[td]read request[/td]

[/tr]

[tr]

[td]Description[/td]

[td]The default order is ID descending.[/td]

[/tr]

[/tbody]

[/table]

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.

[table]

[tbody]

[tr]

[td]HTTP Method[/td]

[td]GET[/td]

[/tr]

[tr]

[td]Base URL[/td]

[td][code]/comments/$id.json[/code][/td]

[/tr]

[tr]

[td]Type[/td]

[td]read request[/td]

[/tr]

[tr]

[td]Description[/td]

[td][code]$id[/code] is the comment ID.[/td]

[/tr]

[/tbody]

[/table]

05 Create

[hr]

Creates a single comment record.

[table]

[tbody]

[tr]

[td]HTTP Method[/td]

[td]POST[/td]

[/tr]

[tr]

[td]Base URL[/td]

[td][code]/comments.json[/code][/td]

[/tr]

[tr]

[td]Type[/td]

[td]write request[/td]

[/tr]

[/tbody]

[/table]

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.

[table]

[tbody]

[tr]

[td]HTTP Method[/td]

[td]PUT/PATCH[/td]

[/tr]

[tr]

[td]Base URL[/td]

[td][code]/comments/$id.json[/code][/td]

[/tr]

[tr]

[td]Type[/td]

[td]write request[/td]

[/tr]

[tr]

[td]Description[/td]

[td][code]$id[/code] is the comment ID.[/td]

[/tr]

[/tbody]

[/table]

Update parameters

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

07 Destroy

[hr]

Deletes a single comment record.

[table]

[tbody]

[tr]

[td]HTTP Method[/td]

[td]DELETE[/td]

[/tr]

[tr]

[td]Base URL[/td]

[td][code]/comments/$id.json[/code][/td]

[/tr]

[tr]

[td]Type[/td]

[td]write request[/td]

[/tr]

[tr]

[td]Description[/td]

[td][code]$id[/code] is the comment ID.[/td]

[/tr]

[/tbody]

[/table]

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.

[table]

[tbody]

[tr]

[td]HTTP Method[/td]

[td]POST[/td]

[/tr]

[tr]

[td]Base URL[/td]

[td][code]/comments/$id/undelete.json[/code][/td]

[/tr]

[tr]

[td]Type[/td]

[td]write request[/td]

[/tr]

[tr]

[td]Description[/td]

[td][code]$id[/code] is the comment ID.[/td]

[/tr]

[/tbody]

[/table]

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

09 See also

[hr]

[hr]

[table]

[tbody]

[tr]

[td]Controller[/td]

[td]<https://github.com/danbooru/danbooru/blob/master/app/controllers/comments_controller.rb>[/td]

[td][/td]

[/tr]

[tr]

[td]Model[/td]

[td]<https://github.com/danbooru/danbooru/blob/master/app/models/comment.rb>[/td]

[/tr]

[tr]

[td]Policy[/td]

[td]<https://github.com/danbooru/danbooru/blob/master/app/policies/comment_policy.rb>[/td]

[/tr]

[/tbody]

[/table]

Page 1