This page has details for how to interact with wiki page records through the API.
01 Record field format
[hr]
| Name | Type | Details |
|---|---|---|
| [code]id[/code] | integer | >0 |
| [code]title[/code] | string | |
| [code]body[/code] | text | |
| [code]other_names[/code] | array | strings |
| [code]is_deleted[/code] | boolean | |
| [code]locked[/code] | boolean | |
| [code]created_at[/code] | timestamp | |
| [code]updated_at[/code] | timestamp |
02 Derived field format
[hr]
These are values which are not part of the actual record, but instead are derived from calculations and record lookups on the fly.
| Name | Type | Details | Notes |
|---|---|---|---|
| [code]category_name[/code] | string | [0,1,3,4,5,null] | It is the [code]category[/code] of the associated tag if it exists, otherwise it is null. |
03 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):
| Name | Type | Number | Availability | Details |
|---|---|---|---|---|
| [code]tag[/code] | tag | single | optional | |
| [code]artist[/code] | artist | single | optional | |
| [code]dtext_links[/code] | dtext link | multiple | optional |
04 Index
[hr]
Returns multiple wiki page records.
| HTTP Method | GET |
| Base URL | [code]/wiki_pages.json[/code] |
| Type | read request |
| Description | The default order is updated at 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]
- String syntax
- [code]title[/code]
- Text syntax
- [code]body[/code]
- Array syntax
- [code]other_names[/code]
- Boolean syntax
- [code]is_deleted[/code]
- [code]is_locked[/code]
- Chaining syntax
- [code]tag[/code]
- [code]artist[/code]
- [code]dtext_links[/code]
Special search parameters
The following are additional search fields.
- [code]title_normalize[/code] - Normalized case-insensitive wildcard searching on the title text field.
- [code]other_names_match[/code] - Case-insensitive wildcard search on any of the other names.
- [code]linked_to[/code] - Wiki pages that have dtext links to the given wiki page.
- The parameter must use the same format as the wiki title.
- I.e. all lowercase and underscores instead of spaces.
- [code]not_linked_to[/code] - Wiki pages that don't have dtext links to the given wiki page.
- Needs the same format as [code]linked_to[/code].
- [code]hide_deleted[/code] - Hides all deleted wikis (Boolean syntax).
- Shortcut for [code]search[is_deleted]=false[/code]
- [code]other_names_present[/code] - Shows wikis based on the presence of other names (Boolean syntax).
- Shortcut for [code]search[other_name_count]=>0[/code] (TRUE) and [code]search[other_name_count]=0[/code] (FALSE)
- [code]has_embedded_media[/code] - Wiki pages that have embedded media on them (Boolean syntax).
Search order
Using the search parameter [code]order[/code] with one of the following values changes the order of the results.
- [code]title[/code] - Title descending.
- [code]post_count[/code] - Post count descending.
- [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.
05 Show
[hr]
Returns a single wiki page record.
| HTTP Method | GET |
| Base URL | [code]/wiki_pages/$id.json[/code] |
| Type | read request |
| Description | [code]$id[/code] is the wiki page ID or title. |
06 Create
[hr]
Creates a single wiki page record.
| HTTP Method | POST |
| Base URL | [code]/wiki_pages.json[/code] |
| Type | write request |
Create parameters
Pool parameters take the following format (see Help:API Write Requests for more info):
[code]
wiki_page[FIELD]=VALUE
[/code]
- Required:
- [code]title[/code]
- Optional
- [code]body[/code]
- [code]other_names[/code] - Uses URL array parameter format.
- Example: [code]wiki_page[other_names][]=blah&wiki_page[other_names][]=foo[/code]
- [code]other_names_string[/code] - Space delimited list of post IDs.
- [code]is_deleted[/code]
- [code]is_locked[/code] - Only Builder users and higher.
07 Update
[hr]
Updates a single wiki page record.
| HTTP Method | PUT/PATCH |
| Base URL | [code]/wiki_pages/$id.json[/code] |
| Type | write request |
| Description | [code]$id[/code] is the wiki page ID or title. |
Update parameters
Accepts the same parameters as the Create action. All parameters are optional.
08 Delete
[hr]
Deletes a single wiki page record.
| HTTP Method | DELETE |
| Base URL | [code]/wiki_pages/$id.json[/code] |
| Type | write request |
| Description | [code]$id[/code] is the wiki page ID or title. |
Note: This action can also be accomplished using the Update action by setting [code]is_deleted[/code] to true.
09 Revert
[hr]
Reverts a single artist record to a prior version.
| HTTP Method | PUT |
| Base URL | [code]/wiki_pages/$id/revert.json[/code] |
| Type | write request |
| Description | [code]$id[/code] is the wiki page ID or title. |
Revert parameters
- Required:
- version_id - The wiki page version ID to revert to.
10 See also
[hr]
11 External links
[hr]
| Controller | <https://github.com/danbooru/danbooru/blob/master/app/controllers/wiki_pages_controller.rb> | |
| Model | <https://github.com/danbooru/danbooru/blob/master/app/models/wiki_page.rb> | |
| Policy | <https://github.com/danbooru/danbooru/blob/master/app/policies/wiki_page_policy.rb> |