This page has details for how to interact with dmail 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]owner_id[/code][/td]
[td]integer[/td]
[td]>0[/td]
[/tr]
[tr]
[td][code]to_id[/code][/td]
[td]integer[/td]
[td]>0[/td]
[/tr]
[tr]
[td][code]from_id[/code][/td]
[td]integer[/td]
[td]>0[/td]
[/tr]
[tr]
[td][code]title[/code][/td]
[td]string[/td]
[td][/td]
[/tr]
[tr]
[td][code]body[/code][/td]
[td]string[/td]
[td][/td]
[/tr]
[tr]
[td][code]is_read[/code][/td]
[td]boolean[/td]
[td][/td]
[/tr]
[tr]
[td][code]is_deleted[/code][/td]
[td]boolean[/td]
[td][/td]
[/tr]
[tr]
[td][code]is_spam[/code][/td]
[td]boolean[/td]
[td]obsolete[/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 Derived field format
[hr]
These are values which are not part of the actual record, but instead are derived from calculations and record lookups on the fly.
[table]
[thead]
[tr]
[th]Name[/th]
[th]Type[/th]
[th]Details[/th]
[th]Notes[/th]
[/tr]
[/thead]
[tbody]
[tr]
[td][code]key[/code][/td]
[td]string[/td]
[td][/td]
[td]Cryptographic key generated from the record.[/td]
[/tr]
[/tbody]
[/table]
03 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]owner[/code][/td]
[td]user[/td]
[td]single[/td]
[td]required[/td]
[td][/td]
[/tr]
[tr]
[td][code]to[/code][/td]
[td]user[/td]
[td]single[/td]
[td]required[/td]
[td][/td]
[/tr]
[tr]
[td][code]from[/code][/td]
[td]user[/td]
[td]single[/td]
[td]required[/td]
[td][/td]
[/tr]
[/tbody]
[/table]
04 Index
[hr]
Returns multiple dmail records.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]GET[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/dmails.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]read request[/td]
[/tr]
[tr]
[td]Description[/td]
[td]The default order is ID descending. Only Dmails to or from the user will be shown, regardless of user level.[/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]title[/code]
- [code]body[/code]
- User syntax
- [code]to[/code]
- [code]from[/code]
- Boolean syntax
- [code]is_read[/code]
- [code]is_deleted[/code]
Special search parameters
The following are additional search fields.
- [code]message_matches[/code] - Case-insensitive wildcard search on the title and body fields.
- [code]folder[/code]
- received - Shows all dmails to the user.
- unread - Shows all unread dmails to the user.
- sent - Shows all dmails from the user.
- deleted - Shows all dmails deleted by the user.
05 Show
[hr]
Returns a single dmail record.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]GET[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/dmails/$id.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]read request[/td]
[/tr]
[tr]
[td]Description[/td]
[td][code]$id[/code] is the dmail ID. Normally only the owner can see the dmail, unless the correct dmail key is also supplied.[/td]
[/tr]
[/tbody]
[/table]
Show parameters.
- [code]key[/code] Unique key for every dmail that will allow anyone to view the dmail.
06 Create
[hr]
Creates a single dmail record.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]POST[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/dmails.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]write request[/td]
[/tr]
[/tbody]
[/table]
Create parameters
Dmail parameters take the following format (see Help:API Write Requests for more info):
[code]
dmail[FIELD]=VALUE
[/code]
- Required:
- To specifier: - must be one of the following
- [code]to_id[/code]
- [code]to_name[/code]
- [code]title[/code]
- [code]body[/code]
07 Update
[hr]
Updates a single comment record.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]PUT/PATCH[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/dmails/$id.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]write request[/td]
[/tr]
[tr]
[td]Description[/td]
[td][code]$id[/code] is the dmail ID.[/td]
[/tr]
[/tbody]
[/table]
Update parameters
- Optional:
- [code]is_read[/code]
- [code]is_deleted[/code]
08 Mark all as read
[hr]
Marks all records as read.
[table]
[tbody]
[tr]
[td]HTTP Method[/td]
[td]POST[/td]
[/tr]
[tr]
[td]Base URL[/td]
[td][code]/dmails/mark_all_as_read.json[/code][/td]
[/tr]
[tr]
[td]Type[/td]
[td]write request[/td]
[/tr]
[/tbody]
[/table]
09 See also
[hr]
10 External links
[table]
[tbody]
[tr]
[td]Controller[/td]
[td]<https://github.com/danbooru/danbooru/blob/master/app/controllers/dmails_controller.rb>[/td]
[td][/td]
[/tr]
[tr]
[td]Model[/td]
[td]<https://github.com/danbooru/danbooru/blob/master/app/models/dmail.rb>[/td]
[/tr]
[tr]
[td]Policy[/td]
[td]<https://github.com/danbooru/danbooru/blob/master/app/policies/dmail_policy.rb>[/td]
[/tr]
[/tbody]
[/table]