This page has details for how to interact with artist commentary records through the API.
[hr]
Record field format
| Name | Type | Details |
|---|---|---|
| [code]id[/code] | integer | >0 |
| [code]post_id[/code] | integer | >0 |
| [code]original_title[/code] | string | |
| [code]original_description[/code] | string | |
| [code]translated_title[/code] | string | |
| [code]translated_description[/code] | string | |
| [code]created_at[/code] | timestamp | |
| [code]updated_at[/code] | timestamp |
[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):
| Name | Type | Number | Availability | Details |
|---|---|---|---|---|
| [code]post[/code] | post | single | required | Post that the artist commentary belongs to. |
[hr]
Index
Returns multiple artist commentary records.
| HTTP Method | GET |
| Base URL | [code]/artist_commentaries.json[/code] |
| Type | read request |
| Description | The default order is ID descending. |
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.
| HTTP Method | GET |
| Base URL | [code]/artist_commentaries/$id.json[/code] [code]/posts/$post_id/artist_commentary.json[/code] |
| Type | read request |
| Description | [code]$id[/code] is the artist commentary ID. [code]$post_id[/code] is ID of the post that the commentary belongs to. |
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.
| HTTP Method | PUT |
| Base URL | [code]/artist_commentaries/create_or_update.json[/code] [code]/posts/$post_id/artist_commentary/create_or_update.json[/code] |
| Type | write request |
| Description | [code]$post_id[/code] is ID of the post that the commentary belongs to. |
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.
| HTTP Method | PUT |
| Base URL | [code]/artist_commentaries/$id/revert.json[/code] [code]/posts/$post_id/artist_commentary/revert.json[/code] |
| Type | write request |
| Description | [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. |
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
| Controller | <https://github.com/danbooru/danbooru/blob/master/app/controllers/artist_commentaries_controller.rb> | |
| Model | <https://github.com/danbooru/danbooru/blob/master/app/models/artist_commentary.rb> | |
| Policy | <https://github.com/danbooru/danbooru/blob/master/app/policies/artist_commentary_policy.rb> |