This page has details for how to interact with wiki page 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]title[/code][/td]
[td]string[/td]
[td][/td]
[/tr]
[tr]
[td][code]body[/code][/td]
[td]text[/td]
[td][/td]
[/tr]
[tr]
[td][code]other_names[/code][/td]
[td]array[/td]
[td]strings[/td]
[/tr]
[tr]
[td][code]is_deleted[/code][/td]
[td]boolean[/td]
[td][/td]
[/tr]
[tr]
[td][code]locked[/code][/td]
[td]boolean[/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]
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.
[table]
[thead]
[tr]
[th]Name[/th]
[th]Type[/th]
[th]Details[/th]
[th]Notes[/th]
[/tr]
[/thead]
[tbody]
[tr]
[td][code]category_name[/code][/td]
[td]string[/td]
[td][0,1,3,4,5,null][/td]
[td]It is the [code]category[/code] of the associated tag if it exists, otherwise it is null.[/td]
[/tr]
[/tbody]
[/table]
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):
[table]
[thead]
[tr]
[th]Name[/th]
[th]Type[/th]
[th]Number[/th]
[th]Availability[/th]
[th]Details[/th]
[/tr]
[/thead]
[tbody]
[tr]
[td][code]tag[/code][/td]
[td]tag[/td]
[td]single[/td]
[td]optional[/td]
[td][/td]
[/tr]
[tr]
[td][code]artist[/code][/td]
[td]artist[/td]
[td]single[/td]
[td]optional[/td]
[td][/td]
[/tr]
[tr]
[td][code]dtext_links[/code][/td]
[td]dtext link[/td]
[td]multiple[/td]
[td]optional[/td]
[td][/td]
[/tr]
[/tbody]
[/table]
04 Index
[hr]
Returns multiple wiki page records.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]GET[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/wiki_pages.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]read request[/td]
[/tr]
[tr]
[td]Description[/td]
[td]The default order is updated at 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]
- 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.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]GET[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/wiki_pages/$id.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]read request[/td]
[/tr]
[tr]
[td]Description[/td]
[td][code]$id[/code] is the wiki page ID or title.[/td]
[/tr]
[/tbody]
[/table]
06 Create
[hr]
Creates a single wiki page record.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]POST[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/wiki_pages.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]write request[/td]
[/tr]
[/tbody]
[/table]
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.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]PUT/PATCH[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/wiki_pages/$id.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]write request[/td]
[/tr]
[tr]
[td]Description[/td]
[td][code]$id[/code] is the wiki page ID or title.[/td]
[/tr]
[/tbody]
[/table]
Update parameters
Accepts the same parameters as the Create action. All parameters are optional.
08 Delete
[hr]
Deletes a single wiki page record.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]DELETE[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/wiki_pages/$id.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]write request[/td]
[/tr]
[tr]
[td]Description[/td]
[td][code]$id[/code] is the wiki page ID or title.[/td]
[/tr]
[/tbody]
[/table]
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.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]PUT[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/wiki_pages/$id/revert.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]write request[/td]
[/tr]
[tr]
[td]Description[/td]
[td][code]$id[/code] is the wiki page ID or title.[/td]
[/tr]
[/tbody]
[/table]
Revert parameters
- Required:
- version_id - The wiki page version ID to revert to.
10 See also
[hr]
11 External links
[hr]
[table]
[tbody]
[tr]
[td]Controller[/td]
[td]<https://github.com/danbooru/danbooru/blob/master/app/controllers/wiki_pages_controller.rb>[/td]
[td][/td]
[/tr]
[tr]
[td]Model[/td]
[td]<https://github.com/danbooru/danbooru/blob/master/app/models/wiki_page.rb>[/td]
[/tr]
[tr]
[td]Policy[/td]
[td]<https://github.com/danbooru/danbooru/blob/master/app/policies/wiki_page_policy.rb>[/td]
[/tr]
[/tbody]
[/table]