api:forum topics
Table of Contents
- 01. Record field format
- 02. Associated attributes
- 03. Index
- 04. Show
- 05. Create
- 06. Update
- 07. Delete
- 08. Undelete
- 09. Mark all as read
- 10. See also
- 11. External links
The following includes the details of how to interface with the forum topic records through the API.
01 Record field format
| Name | Type | Details |
|---|---|---|
id | integer | >0 |
title | string | |
category_id | integer | [0,1,2] |
response_count | integer | |
min_level | integer | Corresponds to the level of user (API:Users). |
is_deleted | boolean | |
is_sticky | boolean | |
is_locked | boolean | |
creator_id | integer | >0 |
updater_id | integer | >0 |
created_at | timestamp | |
updated_at | timestamp |
Category ID
| Value | Description |
|---|---|
| 0 | General |
| 1 | Tags |
| 2 | Bugs & features |
Min level
Min level is an integer when stored in the database, but is used and presented by Danbooru as an enum. Unrestricted access, i.e. a min level of 0, is "None". Every other ID is the user level, with it's name being the titlecase version of that level's name. For example, a min level for Gold members is 30, and is presented to the user as "Gold".
02 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 |
|---|---|---|---|---|
creator | user | single | required | User that created the forum topic. |
updater | user | single | required | User that last updated the forum topic. |
original_post | forum post | single | required | The first forum post of a forum topic. |
03 Index
Returns multiple forum topic records.
| HTTP Method | GET |
| Base URL | /forum_topics.json |
| 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):
search[FIELD]=VALUE
The following are the base fields along with their associated type. Check the syntax pages for all of the available variations.
- Number syntax
idresponse_countcreated_atupdated_at- Text syntax
title- Enum syntax
category- Due to issue #6158, "Bugs & Features" is not searchable when using the search field
category. - Use
category_idand the value of2instead. min_level- User syntax
creatorupdater- Boolean syntax
is_deletedis_stickyis_locked- Chaining syntax
forum_postsbulk_update_requeststag_aliasestag_implications
Special search parameters
The following are additional search fields.
status- The status of an attached BUR. Can be: pending, approved, rejected.is_private- Shows topics that have a min level set or not (Help:Boolean syntax).is_read- Shows topics that have been read by the user or not (Help:Boolean syntax).
Search order
Using the search parameter order with one of the following values changes the order of the results.
sticky- Shows sticky topics first, sorted by updated at second.id- Orders by ID desc.custom- Help:Common URL parameters- In order to use this order,
search[id]must also be set with a list of comma-separated IDs.
04 Show
Returns a single forum topic record.
| HTTP Method | GET |
| Base URL | /forum_topics/$id.json |
| Type | read request |
| Description | $id is the forum topic ID. |
05 Create
Creates a single forum topic record.
| HTTP Method | POST |
| Base URL | /forum_topics.json |
| Type | write request |
Create parameters
Forum topic parameters take the following format (see Help:API Write Requests for more info):
forum_topic[FIELD]=VALUE
- Required:
titlecategory_id- Can be: 0, 1, 2.category- Alternate to
category_id. - Can be
- Optional
original_post_attributes[body]- DText that will be used to create a forum post entry at the same time.- Is a hash value, so the final parameter format is
forum_topic[original_post_attributes][body]
Restricted to Moderator+
- Optional
min_level- Can be: 0, 40, 50is_stickyis_locked
06 Update
Updates a single forum topic record.
| HTTP Method | PUT/PATCH |
| Base URL | /forum_topics/$id.json |
| Type | write request |
| Description | $id is the forum topic ID. |
Update parameters
Accepts the same parameters as the Create action. All parameters are optional.
Original post attributes
Besides those, the Update action also accepts the following additional optional parameters. These can be used to update the opening post of a forum topic if the user is capable of doing that (original poster or Moderator+).
original_post_attributes[id]- The ID of the the first post on a topic.original_post_attributes[body]- The body of the first post on a topic.
The final format of these parameters look like the following:
forum_topic[original_post_attributes][id]=VALUE
The id parameter is required if updating the opening post, and it must match the actual ID of the opening post, i.e. it is not changeable.
07 Delete
Deletes a single forum topic record.
| HTTP Method | DELETE |
| Base URL | /forum_topics/$id.json |
| Type | write request |
| Description | $id is the forum topic ID.Restricted to Moderator+. |
08 Undelete
Undeletes a single forum topic record.
| HTTP Method | POST |
| Base URL | /forum_topics/$id/undelete.json |
| Type | write request |
| Description | $id is the forum topic ID.Restricted to moderator+. |
09 Mark all as read
Marks every topic as being read.
| HTTP Method | POST |
| Base URL | /forum_topics/mark_all_as_read.json |
| Type | write request |
