Edit
Table of Contents
- 01. Record field format
- 02. Associated attributes
- 03. Index
- 04. Show
- 05. Create
- 06. Update
- 07. Delete
- 08. Revert
- 09. Preview
- 10. See also
- 11. External links
This page has details for how to interact with note records through the API.
Record field format
| Name | Type | Details |
|---|---|---|
id | integer | >0 |
post_id | integer | >0 |
body | string | |
x | integer | >0 |
y | integer | >0 |
width | integer | >0 |
height | integer | >0 |
is_active | boolean | |
version | integer | >0 |
created_at | timestamp | |
updated_at | timestamp |
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 |
|---|---|---|---|---|
post | post | single | required |
Index
Returns multiple note records.
| HTTP Method | GET |
| Base URL | /notes.json |
| 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):
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
idxywidthheightversioncreated_atupdated_at- Text syntax
body- Boolean syntax
is_active- Post syntax
post
Search order
Using the search parameter order with one of the following values changes the order of the results.
custom- Help:Common URL parameters- In order to use this order,
search[id]must also be set with a list of comma-separated IDs.
Show
Returns a single note record.
| HTTP Method | GET |
| Base URL | /notes/$id.json |
| Type | read request |
| Description | $id is the note ID. |
Note: This does a redirect to the post with that note when using the HTML interface, specifically highlighting that note when it gets there.
Create
Creates a single note record.
| HTTP Method | POST |
| Base URL | /notes.json |
| Type | write request |
Create parameters
Note parameters take the following format (see Help:API Write Requests for more info):
note[FIELD]=VALUE
- Required:
post_id- The post ID the note belongs to.x- X coordinate of the note starting from the left of the image.y- y coordinate of the note starting from the top of the image.heightwidthbody- Optional
is_active- Whether the note is active or not (i.e. deleted).
Note: The note box must fit within the full-size dimensions of the image.
Update
Updates a single note record.
| HTTP Method | PUT/PATCH |
| Base URL | /notes/$id.json |
| Type | write request |
| Description | $id is the note ID. |
Update parameters
Accepts the same parameters as the Create action, except for the post ID. All parameters are optional.
Delete
Deletes a single note record.
| HTTP Method | DELETE |
| Base URL | /notes/$id.json |
| Type | write request |
| Description | $id is the note ID. |
Revert
Reverts a single note record to a prior version.
| HTTP Method | PUT |
| Base URL | /notes/$id/revert.json |
| Type | write request |
| Description | $id is the note ID. |
Revert parameters
- Required:
version_id- The note version ID to revert to.
Note: The version ID may be passed along as a URL parameter instead of in the body.
Preview
Returns the sanitized version of HTML that Danbooru uses for notes.
| HTTP Method | POST |
| Base URL | /notes/preview.json |
| Type | write request |
| Description | Returns a JSON object that has the same attributes as a note record, with the addition of a sanitized_body field. |
Preview parameters
- Required:
body- The HTML text to sanitize.
Note: The body variable may be passed along as a URL parameter instead of in the request body.
See also
External links
No posts found.
