This page has details for how to interact with artist commentary records through the API.
[hr]
Record field format
[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]original_title[/code][/td]
[td]string[/td]
[td][/td]
[/tr]
[tr]
[td][code]original_description[/code][/td]
[td]string[/td]
[td][/td]
[/tr]
[tr]
[td][code]translated_title[/code][/td]
[td]string[/td]
[td][/td]
[/tr]
[tr]
[td][code]translated_description[/code][/td]
[td]string[/td]
[td][/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]
[hr]
Associated attributes
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]post[/code][/td]
[td]post[/td]
[td]single[/td]
[td]required[/td]
[td]Post that the artist commentary belongs to.[/td]
[/tr]
[/tbody]
[/table]
[hr]
Index
Returns multiple artist commentary records.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]GET[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/artist_commentaries.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]
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.
- Number syntax
- [code]id[/code]
- [code]created_at[/code]
- [code]updated_at[/code]
- Text syntax
- [code]original_title[/code]
- [code]original_description[/code]
- [code]translated_title[/code]
- [code]translated_description[/code]
- Post syntax
- [code]post[/code]
Special search parameters
The following are additional search fields.
- [code]text_matches[/code] - Case-insensitive wildcard searching on any of the text fields.
- [code]original_present[/code] (boolean syntax) - Does it have an original title or an original description?
- [code]translated_present[/code] (boolean syntax) - Does it have a translated title or a translated description?
- [code]is_deleted[/code] - Does it have all empty fields or not? (Help:Boolean Syntax)
Search order
The [code]order[/code] parameter changes the order of the results. The following are the available values for this field.
- [code]id_asc[/code] - ID ascending.
- [code]post_id[/code] - Post ID descending.
- [code]post_id_desc[/code] - Post ID descending.
- [code]post_id_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] - Help:Common URL Parameters
- In order to use this order, [code]search[id][/code] must also be set with a list of comma-separated IDs.
[hr]
Show
Returns a single artist commentary record.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]GET[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/artist_commentaries/$id.json[/code] [code]/posts/$post_id/artist_commentary.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]read request[/td]
[/tr]
[tr]
[td]Description[/td]
[td][code]$id[/code] is the artist commentary ID. [code]$post_id[/code] is ID of the post that the commentary belongs to.[/td]
[/tr]
[/tbody]
[/table]
Note: This does a redirect to the post with that commentary when using the HTML interface.
[hr]
Create or Update
Creates or updates a single artist commentary record.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]PUT[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/artist_commentaries/create_or_update.json[/code] [code]/posts/$post_id/artist_commentary/create_or_update.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]write request[/td]
[/tr]
[tr]
[td]Description[/td]
[td][code]$post_id[/code] is ID of the post that the commentary belongs to.[/td]
[/tr]
[/tbody]
[/table]
Create/update parameters
Artist commentary parameters take the following format (see Help:API Write Requests for more info):
[code]
artist_commentary[FIELD]=VALUE
[/code]
- Required:
- [code]post_id[/code] - The post ID the commentary belongs to.
- When using the [code]/posts/$post_id/[/code] version, the post ID is already set.
- Optional
- [code]original_title[/code]
- [code]original_description[/code]
- [code]translated_title[/code]
- [code]translated_description[/code]
- [code]add_commentary_tag[/code] - Add the Commentary tag.
- [code]add_commentary_request_tag[/code] - Add the Commentary Request tag.
- [code]add_commentary_check_tag[/code] - Add the Check Commentary tag.
- [code]add_partial_commentary_tag[/code] - Add the Partial Commentary tag.
- [code]remove_commentary_tag[/code] - Remove the Commentary tag.
- [code]remove_commentary_request_tag[/code] - Remove the Commentary Request tag.
- [code]remove_commentary_check_tag[/code] - Remove the Check Commentary tag.
- [code]remove_partial_commentary_tag[/code] - Remove the Partial Commentary tag.
[hr]
Revert
Reverts a single artist commentary record to a prior version.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]PUT[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/artist_commentaries/$id/revert.json[/code] [code]/posts/$post_id/artist_commentary/revert.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]write request[/td]
[/tr]
[tr]
[td]Description[/td]
[td][code]$id[/code] is the post ID (not the artist commentary ID). [code]$post_id[/code] is ID of the post that the commentary belongs to.[/td]
[/tr]
[/tbody]
[/table]
Revert parameters
- Required:
- version_id - The artist commentary version ID to revert to.
Note: The version ID may be passed along as a URL parameter instead of in the body.
[hr]
See also
[hr]
External links
[table]
[tbody]
[tr]
[td]Controller[/td]
[td]<https://github.com/danbooru/danbooru/blob/master/app/controllers/artist_commentaries_controller.rb>[/td]
[td][/td]
[/tr]
[tr]
[td]Model[/td]
[td]<https://github.com/danbooru/danbooru/blob/master/app/models/artist_commentary.rb>[/td]
[/tr]
[tr]
[td]Policy[/td]
[td]<https://github.com/danbooru/danbooru/blob/master/app/policies/artist_commentary_policy.rb>[/td]
[/tr]
[/tbody]
[/table]