The following includes the details of how to interface with the post flag records through the API.
Record field format
| Name | Type | Details |
|---|
| [code]id[/code] | integer | >0 |
| [code]post_id[/code] | integer | >0 |
| [code]reason[/code] | string | |
| [code]status[/code] | enum | See Status table for list of acceptable values. |
| [code]is_resolved[/code] | boolean | |
| [code]creator_id[/code] | integer | >0, limited to Moderator+ or the flag creator |
| [code]created_at[/code] | timestamp | |
| [code]updated_at[/code] | timestamp | |
Status
| Value | Enum |
|---|
| 0 | pending |
| 1 | succeeded |
| 2 | rejected |
| Name | Type | Number | Availability | Details |
|---|
| [code]post[/code] | post | single | required | Post that the flag belongs to. |
Nomenclature
- Plural form: "post flags"
- Used in the URL pathname
- Singular form: "post flag"
- Used for write parameters (Help:API Write Requests)
- Versions: none
Index
| HTTP Method | GET |
| Base URL | [code]/post_flags.json[/code] |
| Type | read request |
| Description | The default order is ID descending. |
All of the following are standard attributes with all of their available formats and qualifiers.
- [code]reason_matches[/code] - Case-insensitive wildcard search on the reason field.
- [code]creator_id[/code] - Searches for flags by creator ID. Single ID only.
- [code]creator_name[/code] - Searches for flags by creator name. Single name only.
- [code]category_matches[/code] - Can be: normal, unapproved, rejected, deleted.
Search order
The search order can only be changed with the custom parameter.
Show
| HTTP Method | GET |
| Base URL | [code]/post_flags/$id.json[/code] |
| Type | read request |
| Description | [code]$id[/code] is the post flag ID. |
Create
| HTTP Method | POST |
| Base URL | [code]/post_flags.json[/code] |
| Type | write request |
- Required:
- [code]post_id[/code]
- [code]reason[/code]
See also
External links
| Controller | <https://github.com/danbooru/danbooru/blob/master/app/controllers/post_flags_controller.rb> | |
| Model | <https://github.com/danbooru/danbooru/blob/master/app/models/post_flag.rb> |
| Policy | <https://github.com/danbooru/danbooru/blob/master/app/policies/post_flag_policy.rb> |