This page has details for how to interact with bulk update request records through the API.
01 Record field format
[hr]
| Name | Type | Details |
|---|---|---|
| [code]id[/code] | integer | >0 |
| [code]user_id[/code] | integer | >0 |
| [code]approver_id[/code] | integer | >0 |
| [code]forum_topic_id[/code] | integer | >0 |
| [code]forum_post_id[/code] | integer | >0 |
| [code]script[/code] | text | |
| [code]status[/code] | string | [code][pending, approved, rejected, processing, failed][/code] |
| [code]created_at[/code] | timestamp | |
| [code]updated_at[/code] | timestamp |
02 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]user[/code] | user | single | required | |
| [code]approver[/code] | user | single | optional | |
| [code]forum_topic[/code] | forum topic | single | required | |
| [code]forum_post[/code] | forum post | single | required |
03 Index
[hr]
Returns multiple bulk update request records.
| HTTP Method | GET |
| Base URL | [code]/bulk_update_requests.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]
- String syntax
- [code]script[/code]
- Array syntax
- [code]tags[/code]
- User syntax
- [code]user[/code]
- [code]approver[/code]
- Chaining syntax
- [code]forum_topic[/code]
- [code]forum_post[/code]
Special search parameters
The following are additional search fields.
- [code]status[/code] - The status of the bulk update request (separated by commas).
Search order
Using the search parameter [code]order[/code] with one of the following values changes the order of the results.
- [code]id_desc[/code] - ID descending.
- [code]id_asc[/code] - ID ascending.
- [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.
04 Show
[hr]
Returns a single bulk update request record.
| HTTP Method | GET |
| Base URL | [code]/bulk_update_requests/$id.json[/code] |
| Type | read request |
| Description | [code]$id[/code] is the bulk update request ID. |
05 Create
[hr]
Creates a single bulk update request record.
| HTTP Method | POST |
| Base URL | [code]/bulk_update_requests.json[/code] |
| Type | write request |
Create parameters
Bulk update request parameters take the following format (see Help:API Write Requests for more info):
[code]
bulk_update_request[FIELD]=VALUE
[/code]
- Mandatory:
- [code]script[/code]
- [code]reason[/code]
If the forum topic ID is present, then the title is ignored, and the BUR gets attached to the assigned forum topic ID.
- Option 1
- [code]forum_topic_id[/code]
If forum topic ID is absent, then title will be used to create a new forum topic.
- Option 2
- [code]title[/code]
In either case, the reason will be used to create a new forum post.
06 Update
Updates a single bulk update request record.
[hr]
| HTTP Method | PUT/PATCH |
| Base URL | [code]/bulk_update_request/$id.json[/code] |
| Type | write request |
| Description | [code]$id[/code] is the bulk update request ID. Only non-approved BURs can be updated. |
Update parameters
- Optional:
- [code]script[/code]
- Admin-only parameters:
- [code]forum_post_id[/code]
- [code]forum_topic_id[/code]
Note: Only the creator or an Admin can update a bulk update request.
07 Destroy
[hr]
Deletes a single bulk update request record.
| HTTP Method | DELETE |
| Base URL | [code]/bulk_update_request/$id.json[/code] |
| Type | write request |
| Description | [code]$id[/code] is the bulk update request ID. Only pending BURs can be deleted. |
Note: Only the creator or an Admin can delete a bulk update request.
09 Approve
[hr]
Approves a single bulk update request record.
| HTTP Method | POST |
| Base URL | [code]/bulk_update_request/$id/approve.json[/code] |
| Type | write request |
| Description | [code]$id[/code] is the bulk update request ID. Only non-approved BURs can be updated. |
Approval conditions
Builders and above can approve bulk update requests that:
[quote]
- Creator of the bulk update request
- [code]rename[/code] or [code]alias[/code] commands
- Only artist tags
- The antecedent must be an artist tag
- The consequent must be:
- An artist tag
- A non-exitent tag
- An empty tag of any category
- Post count must be less than or equeal to 200
- For the antecedent
- For the consequent if it is a non-empty artist tag
[/quote]
Otherwise, only an admin can approve that request.
09 See also
[hr]
10 External links
[hr]
| Controller | <https://github.com/danbooru/danbooru/blob/master/app/controllers/bulk_update_requests_controller.rb> | |
| Model | <https://github.com/danbooru/danbooru/blob/master/app/models/bulk_update_request.rb> | |
| Policy | <https://github.com/danbooru/danbooru/blob/master/app/policies/bulk_update_request_policy.rb> |