This page has details for how to interact with bulk update request 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]user_id[/code][/td]
[td]integer[/td]
[td]>0[/td]
[/tr]
[tr]
[td][code]approver_id[/code][/td]
[td]integer[/td]
[td]>0[/td]
[/tr]
[tr]
[td][code]forum_topic_id[/code][/td]
[td]integer[/td]
[td]>0[/td]
[/tr]
[tr]
[td][code]forum_post_id[/code][/td]
[td]integer[/td]
[td]>0[/td]
[/tr]
[tr]
[td][code]script[/code][/td]
[td]text[/td]
[td][/td]
[/tr]
[tr]
[td][code]status[/code][/td]
[td]string[/td]
[td][code][pending, approved, rejected, processing, failed][/code][/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 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]user[/code][/td]
[td]user[/td]
[td]single[/td]
[td]required[/td]
[td][/td]
[/tr]
[tr]
[td][code]approver[/code][/td]
[td]user[/td]
[td]single[/td]
[td]optional[/td]
[td][/td]
[/tr]
[tr]
[td][code]forum_topic[/code][/td]
[td]forum topic[/td]
[td]single[/td]
[td]required[/td]
[td][/td]
[/tr]
[tr]
[td][code]forum_post[/code][/td]
[td]forum post[/td]
[td]single[/td]
[td]required[/td]
[td][/td]
[/tr]
[/tbody]
[/table]
03 Index
[hr]
Returns multiple bulk update request records.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]GET[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/bulk_update_requests.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]read request[/td]
[/tr]
[tr]
[td]Description[/td]
[td]The default order is ID 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]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.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]GET[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/bulk_update_requests/$id.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]read request[/td]
[/tr]
[tr]
[td]Description[/td]
[td][code]$id[/code] is the bulk update request ID.[/td]
[/tr]
[/tbody]
[/table]
05 Create
[hr]
Creates a single bulk update request record.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]POST[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/bulk_update_requests.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]write request[/td]
[/tr]
[/tbody]
[/table]
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]
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]PUT/PATCH[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/bulk_update_request/$id.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]write request[/td]
[/tr]
[tr]
[td]Description[/td]
[td][code]$id[/code] is the bulk update request ID. Only non-approved BURs can be updated.[/td]
[/tr]
[/tbody]
[/table]
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.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]DELETE[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/bulk_update_request/$id.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]write request[/td]
[/tr]
[tr]
[td]Description[/td]
[td][code]$id[/code] is the bulk update request ID. Only pending BURs can be deleted.[/td]
[/tr]
[/tbody]
[/table]
Note: Only the creator or an Admin can delete a bulk update request.
09 Approve
[hr]
Approves a single bulk update request record.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]POST[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/bulk_update_request/$id/approve.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]write request[/td]
[/tr]
[tr]
[td]Description[/td]
[td][code]$id[/code] is the bulk update request ID. Only non-approved BURs can be updated.[/td]
[/tr]
[/tbody]
[/table]
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]
[table]
[tbody]
[tr]
[td]Controller[/td]
[td]<https://github.com/danbooru/danbooru/blob/master/app/controllers/bulk_update_requests_controller.rb>[/td]
[td][/td]
[/tr]
[tr]
[td]Model[/td]
[td]<https://github.com/danbooru/danbooru/blob/master/app/models/bulk_update_request.rb>[/td]
[/tr]
[tr]
[td]Policy[/td]
[td]<https://github.com/danbooru/danbooru/blob/master/app/policies/bulk_update_request_policy.rb>[/td]
[/tr]
[/tbody]
[/table]