This page has details for how to interact with pool 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]name[/code][/td]
[td]string[/td]
[td][/td]
[/tr]
[tr]
[td][code]description[/code][/td]
[td]string[/td]
[td][/td]
[/tr]
[tr]
[td][code]post_ids[/code][/td]
[td]array[/td]
[td]integers > 0[/td]
[/tr]
[tr]
[td][code]category[/code][/td]
[td]string[/td]
[td][series, collection][/td]
[/tr]
[tr]
[td][code]is_deleted[/code][/td]
[td]boolean[/td]
[td][/td]
[/tr]
[tr]
[td][code]is_active[/code][/td]
[td]boolean[/td]
[td]unused[/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
There are no available relations that can be included through the API.
[hr]
Index
Returns multiple pool records.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]GET[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/pools.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]
- Text syntax
- [code]name[/code]
- [code]description[/code]
- Array syntax
- [code]post_ids[/code]
- Boolean syntax
- [code]is_deleted[/code]
- Chaining syntax
- [code]dtext_links[/code]
Special search parameters
The following are additional search fields.
- [code]name_contains[/code] - Normalized case-insensitive search with wildcards at the start and end.
- [code]post_tags_match[/code] - The pools's post's tags match the given terms. Meta-tags not supported.
- [code]linked_to[/code] - Pools 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] - Pools that don't have dtext links to the given wiki page.
- Needs the same format as [code]linked_to[/code].
- [code]category[/code]
- [code]series[/code] - Only series-type pools.
- [code]collection[/code] - Only collection-type pools.
Search order
Using the search parameter [code]order[/code] with one of the following values changes the order of the results.
- [code]name[/code] - Name descending.
- [code]created_at[/code] - Created at 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.
[hr]
Show
Returns a single pool record.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]GET[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/pools/$id.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]read request[/td]
[/tr]
[tr]
[td]Description[/td]
[td][code]$id[/code] is the pool ID.[/td]
[/tr]
[/tbody]
[/table]
[hr]
Create
Creates a single pool record.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]POST[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/pools.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]
pool[FIELD]=VALUE
[/code]
- Required:
- [code]name[/code]
- [code]category[/code] - Can be: series, collection.
- Optional
- [code]description[/code]
- [code]post_ids[/code] - Uses URL array parameter format.
- Example: [code]pool[post_ids][]=1&pool[post_ids][]=2[/code]
- [code]post_ids_string[/code] - Space delimited list of post IDs.
[hr]
Update
Updates a single pool record.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]PUT/PATCH[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/pools/$id.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]write request[/td]
[/tr]
[tr]
[td]Description[/td]
[td][code]$id[/code] is the pool ID.[/td]
[/tr]
[/tbody]
[/table]
Update parameters
Accepts the same parameters as the Create action. All parameters are optional. Only Builders and above can update a deleted record.
[hr]
Delete
Deletes a single pool record.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]DELETE[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/pools/$id.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]write request[/td]
[/tr]
[tr]
[td]Description[/td]
[td][code]$id[/code] is the pool ID.[/td] Only Builders and above can use this action.
[/tr]
[/tbody]
[/table]
[hr]
Undelete
Undeletes a single pool record.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]POST[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/pools/$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 pool ID.[/td] Only Builders and above can use this action.
[/tr]
[/tbody]
[/table]
[hr]
Revert
Reverts an a pool record to a prior version.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]PUT[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/pools/$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 pool ID.[/td]
[/tr]
[/tbody]
[/table]
Revert parameters
- Required:
- version_id - The pool 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/pools_controller.rb>[/td]
[td][/td]
[/tr]
[tr]
[td]Model[/td]
[td]<https://github.com/danbooru/danbooru/blob/master/app/models/pool.rb>[/td]
[/tr]
[tr]
[td]Policy[/td]
[td]<https://github.com/danbooru/danbooru/blob/master/app/policies/pool_policy.rb>[/td]
[/tr]
[/tbody]
[/table]