From 25cf910f7bf26179ea337c95df060e6a99cc42ae Mon Sep 17 00:00:00 2001 From: Fuwn Date: Mon, 23 Feb 2026 09:51:17 -0800 Subject: docs: add booru api references and held-post plans --- docs/api/README.md | 24 + docs/api/danbooru-help-api.html | 693 +++++++++++++ docs/api/gelbooru-howto-api.html | 124 +++ docs/api/konachan-help-api.html | 1016 +++++++++++++++++++ docs/api/safebooru-dapi-help.html | 159 +++ docs/api/sakugabooru-help-api.html | 1009 +++++++++++++++++++ docs/api/yandere-help-api.html | 1021 ++++++++++++++++++++ docs/plans/2026-02-23-held-posts-toggle-design.md | 29 + .../2026-02-23-held-posts-toggle-implementation.md | 68 ++ 9 files changed, 4143 insertions(+) create mode 100644 docs/api/README.md create mode 100644 docs/api/danbooru-help-api.html create mode 100644 docs/api/gelbooru-howto-api.html create mode 100644 docs/api/konachan-help-api.html create mode 100644 docs/api/safebooru-dapi-help.html create mode 100644 docs/api/sakugabooru-help-api.html create mode 100644 docs/api/yandere-help-api.html create mode 100644 docs/plans/2026-02-23-held-posts-toggle-design.md create mode 100644 docs/plans/2026-02-23-held-posts-toggle-implementation.md diff --git a/docs/api/README.md b/docs/api/README.md new file mode 100644 index 0000000..c6f3918 --- /dev/null +++ b/docs/api/README.md @@ -0,0 +1,24 @@ +# Supported Provider API Docs (Snapshot) + +These are local HTML snapshots of API documentation for providers currently supported by Sora. +Fetched on 2026-02-23 (US/Pacific) using `curl -L` with a browser user agent. + +## Sources + +- Danbooru: https://danbooru.donmai.us/wiki_pages/help:api + - Local copy: `docs/api/danbooru-help-api.html` +- Yande.re (Moebooru): https://yande.re/help/api + - Local copy: `docs/api/yandere-help-api.html` +- Konachan (Moebooru): https://konachan.com/help/api + - Local copy: `docs/api/konachan-help-api.html` +- Sakugabooru (Moebooru): https://sakugabooru.com/help/api + - Local copy: `docs/api/sakugabooru-help-api.html` +- Gelbooru: https://gelbooru.com/index.php?id=18780&page=wiki&s=view + - Local copy: `docs/api/gelbooru-howto-api.html` +- Safebooru (Gelbooru-family DAPI): https://safebooru.org/index.php?page=help&topic=dapi + - Local copy: `docs/api/safebooru-dapi-help.html` + +## Notes + +- These are point-in-time copies and may drift from live docs. +- Re-fetch when changing provider request/auth/pagination/sort behavior. diff --git a/docs/api/danbooru-help-api.html b/docs/api/danbooru-help-api.html new file mode 100644 index 0000000..b29b8a6 --- /dev/null +++ b/docs/api/danbooru-help-api.html @@ -0,0 +1,693 @@ + + + + + + Help:Api Wiki | Danbooru + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + Danbooru +
+ + + + + +
+ + +
+ + +
+ + + + + + +
+ + +
+ + + + + + + +
+
+ + +
+
+ +
+ +
+ + + + diff --git a/docs/api/gelbooru-howto-api.html b/docs/api/gelbooru-howto-api.html new file mode 100644 index 0000000..b150bad --- /dev/null +++ b/docs/api/gelbooru-howto-api.html @@ -0,0 +1,124 @@ + + + + howto:api - Wiki | Gelbooru - Anime Art & Hentai Gallery - Free to Explore + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ Notice: My personal stance on AI generated artwork. Retweet and share if you agree. Let us discuss, and not immediately scream bloody murder. +
+ +
+
+ + + + + + + +
+
+
+
+
+ + +
+
+
+
+
+
+ + + +
+

Now Viewing: howto:api


Tag type: None

+

Api Basics Documentation


You should never receive an error unless the server is overloaded or the search dies.

Authentication


We will occasionally require authentication to access our API and throttle access to our API. This is to mitigate abusive behavior.

&api_key=API_KEY_HERE&user_id=USER_ID_HERE

API_KEY_HERE Your API Key which is accessible within your account options page.
USER_ID_HERE Your user ID, which is accessible on the account options/profile page.

Your requests will not be limited if you have contributed to the Patreon in the past.

Posts List



Url for API access: /index.php?page=dapi&s=post&q=index

limit How many posts you want to retrieve. There is a default limit of 100 posts per request.
pid The page number.
tags The tags to search for. Any tag combination that works on the web site will work here. This includes all the meta-tags. See howto:search and howto:cheatsheet for more information.
cid Change ID of the post. This is in Unix time so there are likely others with the same value if updated at the same time.
id The post id.
json Set to 1 for JSON formatted response.

Tag List



Url for API access: /index.php?page=dapi&s=tag&q=index

id The tag's id in the database. This is useful to grab a specific tag if you already know this value.
limit How many tags you want to retrieve. There is a default limit of 100 per request.
after_id Grab tags whose ID is greater than this value.
name Find tag information based on this value.
names Separated by spaces, get multiple results to tags you specify if it exists. (schoolgirl moon cat)
name_pattern A wildcard search for your query using LIKE. Use _ for single character wildcards or % for multi-character wildcards. (%choolgirl% would act as *choolgirl* wildcard search.)
json Set to 1 for JSON formatted response.
order Order by field specified (ASC or DESC)
orderby Order by a field.
- date
- count
- name

User List



Url for API access: /index.php?page=dapi&s=user&q=index

limit How many posts you want to retrieve. There is a default limit of 100 posts per request.
pid The page number.
name The username to search for
name_pattern The username to search for, using a wildcard search.
json Set to 1 for JSON formatted response.


Comments List



Url for API access: /index.php?page=dapi&s=comment&q=index

post_id The id number of the comment to retrieve.


Deleted Images



Url for API access: /index.php?page=dapi&s=post&q=index&deleted=show

last_id A numerical value. Will return everything above this number.




+ Other Wiki Information

+
Last updated: 02/22/22 4:17 PM by lozertuser
lock This entry is locked and can not be edited.


+
There are no images associated with this wiki entry.


+
\ No newline at end of file diff --git a/docs/api/konachan-help-api.html b/docs/api/konachan-help-api.html new file mode 100644 index 0000000..eef4e0b --- /dev/null +++ b/docs/api/konachan-help-api.html @@ -0,0 +1,1016 @@ + + + + + konachan.com - Konachan.com Anime Wallpapers + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

Help: API 1.13.0+update.3

+ +
+

Moebooru offers API which is mostly compatible with Danbooru API (version 1.13.0) to make scripting easy. All you need is a way to GET and POST to URLs. The ability to parse XML or JSON responses is nice, but not critical. The simplicity of the API means you can write scripts using JavaScript, Perl, Python, Ruby, even shell languages like bash or tcsh.

+

Change Log | Posts | Tags | Artists | Comments | Wiki | Notes | Users | Forum | Pools

+
+ +
+
+

Basics

+

HTTP defines two request methods: GET and POST. You'll be using these two methods to interact with the Danbooru API. Most API calls that change the state of the database (like creating, updating, or deleting something) require an HTTP POST call. API calls that only retrieve data can typically be done with an HTTP GET call.

+

In the Danbooru API, a URL is analogous to a function name. You pass in the function parameters as a query string. Here's an extremely simple example: /post.xml?limit=1.

+

The post part indicates the controller we're working with. In this case it's posts. index describes the action. Here we're retrieving a list of posts. Finally, the xml part describes what format we want the response in. You can specify .xml for XML responses, .json for JSON responses, and nothing at all for HTML responses.

+
+ +
+

Responses

+

All API calls that change state will return a single element response (for XML calls). They are formatted like this:

+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <response success="false" reason="duplicate"/> +
+

For JSON responses, they'll look like this:

+
+ {success: false, reason: "duplicate"} +
+

While you can usually determine success or failure based on the response object, you can also figure out what happened based on the HTTP status code. In addition to the standard ones, Danbooru uses some custom status codes in the 4xx and 5xx range.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Status CodeMeaning
200 OKRequest was successful
403 ForbiddenAccess denied
404 Not FoundNot found
420 Invalid RecordRecord could not be saved
421 User ThrottledUser is throttled, try again later
422 LockedThe resource is locked and cannot be modified
423 Already ExistsResource already exists
424 Invalid ParametersThe given parameters were invalid
500 Internal Server ErrorSome unknown error occurred on the server
503 Service UnavailableServer cannot currently handle the request, try again later
+
+ +
+

JSON Responses

+

While you will probably want to work with XML in the majority of cases, if you're writing something in Javascript then the JSON responses may be preferable. They are much faster to parse and there's less code to write to get your data structure:

+
+ var data = eval("(" + responseText + ")")
+ alert(data.response) +
+
+ +
+

Logging In

+

Some actions may require you to log in. For any action you can always specify two parameters to identify yourself:

+
    +
  • login Your login name.
  • +
  • password_hash Your SHA1 hashed password. Simply hashing your plain password will NOT work since Danbooru salts its passwords. The actual string that is hashed is "So-I-Heard-You-Like-Mupkids-?--your-password--".
  • +
+

Please be aware of the security risks involved in sending your password through an unencrypted channel. Although your password will be hashed, it is still theoretically possible for someone to steal your account by creating a fake cookie based on your hashed password.

+
+
+ + + +
+ +

Posts

+ +
+

List

+

The base URL is /post.xml.

+
    +
  • limit How many posts you want to retrieve. There is a hard limit of 100 posts per request.
  • +
  • page The page number.
  • +
  • tags The tags to search for. Any tag combination that works on the web site will work here. This includes all the meta-tags.
  • +
+
+ +
+

Create

+

The base URL is /post/create.xml. There are only two mandatory fields: you need to supply the tags, and you need to supply the file, either through a multipart form or through a source URL.

+
    +
  • post[tags] A space delimited list of tags.
  • +
  • post[file] The file data encoded as a multipart form.
  • +
  • post[rating] The rating for the post. Can be: safe, questionable, or explicit.
  • +
  • post[source] If this is a URL, Danbooru will download the file.
  • +
  • post[is_rating_locked] Set to true to prevent others from changing the rating.
  • +
  • post[is_note_locked] Set to true to prevent others from adding notes.
  • +
  • post[parent_id] The ID of the parent post.
  • +
  • md5 Supply an MD5 if you want Danbooru to verify the file after uploading. If the MD5 doesn't match, the post is destroyed.
  • +
+

If the call fails, the following response reasons are possible:

+
    +
  • MD5 mismatch This means you supplied an MD5 parameter and what Danbooru got doesn't match. Try uploading the file again.
  • +
  • duplicate This post already exists in Danbooru (based on the MD5 hash). An additional attribute called location will be set, pointing to the (relative) URL of the original post.
  • +
  • other Any other error will have its error message printed.
  • +
+

If the post upload succeeded, you'll get an attribute called location in the response pointing to the relative URL of your newly uploaded post.

+
+
+

Update

+

The base URL is /post/update.xml. Only the id parameter is required. Leave the other parameters blank if you don't want to change them.

+
    +
  • id The id number of the post to update.
  • +
  • post[tags] A space delimited list of tags.
  • +
  • post[file] The file data encoded as a multipart form.
  • +
  • post[rating] The rating for the post. Can be: safe, questionable, or explicit.
  • +
  • post[source] If this is a URL, Danbooru will download the file.
  • +
  • post[is_rating_locked] Set to true to prevent others from changing the rating.
  • +
  • post[is_note_locked] Set to true to prevent others from adding notes.
  • +
  • post[parent_id] The ID of the parent post.
  • +
+
+
+

Destroy

+

You must be logged in to use this action. You must also be the user who uploaded the post (or you must be a moderator).

+
    +
  • id The id number of the post to delete.
  • +
+
+
+

Revert Tags

+

This action reverts a post to a previous set of tags. The base URL is /post/revert_tags.xml.

+
    +
  • id The post id number to update.
  • +
  • history_id The id number of the tag history.
  • +
+
+
+

Vote

+

This action lets you vote for a post. You can only vote once per post per IP address. The base URL is /post/vote.xml.

+
    +
  • id The post id number to update.
  • +
  • score Set to 1 to vote up and -1 to vote down. All other values will be ignored.
  • +
+

If the call did not succeed, the following reasons are possible:

+
    +
  • already voted You have already voted for this post.
  • +
  • invalid score You have supplied an invalid score.
  • +
+
+
+ + + +
+ +

Tags

+ +
+

List

+

The base URL is /tag.xml.

+
    +
  • limit How many tags to retrieve. Setting this to 0 will return every tag.
  • +
  • page The page number.
  • +
  • order Can be date, count, or name.
  • +
  • id The id number of the tag.
  • +
  • after_id Return all tags that have an id number greater than this.
  • +
  • name The exact name of the tag.
  • +
  • name_pattern Search for any tag that has this parameter in its name.
  • +
+
+
+

Update

+

The base URL is /tag/update.xml.

+
    +
  • name The name of the tag to update.
  • +
  • tag[tag_type] The tag type. General: 0, artist: 1, copyright: 3, character: 4.
  • +
  • tag[is_ambiguous] Whether or not this tag is ambiguous. Use 1 for true and 0 for false.
  • +
+
+
+

Related

+

The base URL is /tag/related.xml.

+
    +
  • tags The tag names to query.
  • +
  • type Restrict results to this tag type (can be general, artist, copyright, or character).
  • +
+
+
+ + + +
+ +

Artists

+ +
+

List

+

The base URL is /artist.xml.

+
    +
  • name The name (or a fragment of the name) of the artist.
  • +
  • order Can be date or name.
  • +
  • page The page number.
  • +
+
+
+

Create

+

The base URL is /artist/create.xml.

+
    +
  • artist[name] The artist's name.
  • +
  • artist[urls] A list of URLs associated with the artist, whitespace delimited.
  • +
  • artist[alias] The artist that this artist is an alias for. Simply enter the alias artist's name.
  • +
  • artist[group] The group or cicle that this artist is a member of. Simply enter the group's name.
  • +
+
+
+

Update

+

The base URL is /artist/update.xml. Only the id parameter is required. The other parameters are optional.

+
    +
  • id The id of thr artist to update.
  • +
  • artist[name] The artist's name.
  • +
  • artist[urls] A list of URLs associated with the artist, whitespace delimited.
  • +
  • artist[alias] The artist that this artist is an alias for. Simply enter the alias artist's name.
  • +
  • artist[group] The group or cicle that this artist is a member of. Simply enter the group's name.
  • +
+
+
+

Destroy

+

The base URL is /artist/destroy.xml. You must be logged in to delete artists.

+
    +
  • id The id of the artist to destroy.
  • +
+
+
+ + + +
+ +

Comments

+ +
+

Show

+

The base URL is /comment/show.xml. This retrieves a single comment.

+
    +
  • id The id number of the comment to retrieve.
  • +
+
+ +
+

Create

+

The base URL is /comment/create.xml.

+
    +
  • comment[anonymous] Set to 1 if you want to post this comment anonymously.
  • +
  • comment[post_id] The post id number to which you are responding.
  • +
  • comment[body] The body of the comment.
  • +
+
+ +
+

Destroy

+

The base url is /comment/destroy.xml. You must be logged in to use this action. You must also be the owner of the comment, or you must be a moderator.

+
    +
  • id The id number of the comment to delete.
  • +
+
+
+ + + +
+ +

Wiki

+

All titles must be exact (but case and whitespace don't matter).

+ +
+

List

+

The base URL is /wiki.xml. This retrieves a list of every wiki page.

+
    +
  • order How you want the pages ordered. Can be: title, date.
  • +
  • limit The number of pages to retrieve.
  • +
  • page The page number.
  • +
  • query A word or phrase to search for.
  • +
+
+ +
+

Create

+

The base URL is /wiki/create.xml.

+
    +
  • wiki_page[title] The title of the wiki page.
  • +
  • wiki_page[body] The body of the wiki page.
  • +
+
+ +
+

Update

+

The base URL is /wiki/update.xml. Potential error reasons: "Page is locked"

+
    +
  • title The title of the wiki page to update.
  • +
  • wiki_page[title] The new title of the wiki page.
  • +
  • wiki_page[body] The new body of the wiki page.
  • +
+
+ +
+

Show

+

The base URL is /wiki/show.xml. Potential error reasons: "artist type"

+
    +
  • title The title of the wiki page to retrieve.
  • +
  • version The version of the page to retrieve.
  • +
+
+ +
+

Destroy

+

The base URL is /wiki/destroy.xml. You must be logged in as a moderator to use this action.

+
    +
  • title The title of the page to delete.
  • +
+
+ +
+

Lock

+

The base URL is /wiki/lock.xml. You must be logged in as a moderator to use this action.

+
    +
  • title The title of the page to lock.
  • +
+
+ +
+

Unlock

+

The base URL is /wiki/unlock.xml. You must be logged in as a moderator to use this action.

+
    +
  • title The title of the page to unlock.
  • +
+
+ +
+

Revert

+

The base URL is /wiki/revert.xml. Potential error reasons: "Page is locked"

+
    +
  • title The title of the wiki page to update.
  • +
  • version The version to revert to.
  • +
+
+ +
+

History

+

The base URL is /wiki/history.xml.

+
    +
  • title The title of the wiki page to retrieve versions for.
  • +
+
+
+ + + +
+ +

Notes

+ +
+

List

+

The base URL is /note.xml.

+
    +
  • post_id The post id number to retrieve notes for.
  • +
+
+ +
+

Search

+

The base URL is /note/search.xml.

+
    +
  • query A word or phrase to search for.
  • +
+
+ +
+

History

+

The base URL is /note/history.xml. You can either specify id, post_id, or nothing. Specifying nothing will give you a list of every note verison.

+
    +
  • limit How many versions to retrieve.
  • +
  • page The offset.
  • +
  • post_id The post id number to retrieve note versions for.
  • +
  • id The note id number to retrieve versions for.
  • +
+
+ +
+

Revert

+

The base URL is /note/revert.xml. Potential error reasons: "Post is locked"

+
    +
  • id The note id to update.
  • +
  • version The version to revert to.
  • +
+
+ +
+

Create/Update

+

The base URL is /note/update.xml. Notes differ from the other controllers in that the interface for creation and updates is the same. If you supply an id parameter, then Danbooru will assume you're updating an existing note. Otherwise, it will create a new note. Potential error reasons: "Post is locked"

+
    +
  • id If you are updating a note, this is the note id number to update.
  • +
  • note[post_id] The post id number this note belongs to.
  • +
  • note[x] The x coordinate of the note.
  • +
  • note[y] The y coordinate of the note.
  • +
  • note[width] The width of the note.
  • +
  • note[height] The height of the note.
  • +
  • note[is_active] Whether or not the note is visible. Set to 1 for active, 0 for inactive.
  • +
  • note[body] The note message.
  • +
+
+
+ + + +
+ +

Users

+ +
+

Search

+

The base URL is /user.xml. If you don't specify any parameters you'll get a listing of all users.

+
    +
  • id The id number of the user.
  • +
  • name The name of the user.
  • +
+
+
+ + + +
+ +

Forum

+ +
+

List

+

The base URL is /forum.xml. If you don't specify any parameters you'll get a list of all the parent topics.

+
    +
  • parent_id The parent ID number. You'll return all the responses to that forum post.
  • +
+
+
+ + + +
+ +

Pools

+ +
+

List Pools

+

The base URL is /pool.xml. If you don't specify any parameters you'll get a list of all pools.

+
    +
  • query The title.
  • +
  • page The page.
  • +
+
+ +
+

List Posts

+

The base URL is /pool/show.xml. If you don't specify any parameters you'll get a list of all pools.

+
    +
  • id The pool id number.
  • +
  • page The page.
  • +
+
+ +
+

Update

+

The base URL is /pool/update.xml.

+
    +
  • id The pool id number.
  • +
  • pool[name] The name.
  • +
  • pool[is_public] 1 or 0, whether or not the pool is public.
  • +
  • pool[description] A description of the pool.
  • +
+
+ +
+

Create

+

The base URL is /pool/create.xml.

+
    +
  • pool[name] The name.
  • +
  • pool[is_public] 1 or 0, whether or not the pool is public.
  • +
  • pool[description] A description of the pool.
  • +
+
+ +
+

Destroy

+

The base URL is /pool/destroy.xml.

+
    +
  • id The pool id number.
  • +
+
+ +
+

Add Post

+

The base URL is /pool/add_post.xml. Potential error reasons: "Post already exists", "access denied"

+
    +
  • pool_id The pool to add the post to.
  • +
  • post_id The post to add.
  • +
+
+ +
+

Remove Post

+

The base URL is /pool/remove_post.xml. Potential error reasons: "access denied"

+
    +
  • pool_id The pool to remove the post from.
  • +
  • post_id The post to remove.
  • +
+
+ +
+ + + +
+ +

Favorites

+ +
+

List Users

+

The base URL is /favorite/list_users.json. There is no XML API for this action.

+
    +
  • id The post id.
  • +
+
+
+ + + +
+ +

Change Log

+
+

1.13.0+update.3

+
    +
  • Removed /index from API URLs
  • +
+

1.13.0+update.2

+
    +
  • Readd favorite/list_users API
  • +
+

1.13.0+update.1

+
    +
  • Added documentation for pools
  • +
+ +

1.13.0

+
    +
  • Changed interface for artists to use new URL system
  • +
  • JSON requests now end in a .json suffix
  • +
  • Renamed some error reason messages
  • +
  • Removed comment/index from API
  • +
  • Removed url and md5 parameters from artist search (can just pass the URL or MD5 hash to the name parameter)
  • +
+
+ +
+

1.8.1

+
    +
  • Removed post[is_flagged] attribute
  • +
+
+
+
+ + + +
+ + + + + + + + + + + + diff --git a/docs/api/safebooru-dapi-help.html b/docs/api/safebooru-dapi-help.html new file mode 100644 index 0000000..bf4554e --- /dev/null +++ b/docs/api/safebooru-dapi-help.html @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + Safebooru + + + + + + + + + + + + + + + + +
+
+
+

API Basics

+ You should never receive an error unless the server is overloaded or the search dies. In cases of the searcher breaking, you will receive a response success of "false" and a message stating "search down" or similiar.

+
+

Posts

+

List

+Url for API access: index.php?page=dapi&s=post&q=index

+
    +
  • limit How many posts you want to retrieve. There is a hard limit of 1000 posts per request.
  • +
  • pid The page number.
  • +
  • tags The tags to search for. Any tag combination that works on the web site will work here. This includes all the meta-tags. See cheatsheet for more information.
  • +
  • cid Change ID of the post. This is in Unix time so there are likely others with the same value if updated at the same time.
  • +
  • id The post id.
  • +
  • json Set to 1 for JSON formatted response.
  • +
+ +

Deleted Images

+Url for API access: index.php?page=dapi&s=post&q=index&deleted=show

+
    +
  • last_id A numerical value. Will return everything above this number.
  • +
+
+
+

Comments

+

List

+Url for API access: ndex.php?page=dapi&s=comment&q=index

+
    +
  • post_id The id number of the comment to retrieve.
  • +
+ +
+ +
+

Tags

+

List

+Url for API access: index.php?page=dapi&s=tag&q=index
+
+
    +
  • id The tag's id in the database. This is useful to grab a specific tag if you already know this value.
  • +
  • limit How many tags you want to retrieve. There is a default limit of 100 per request.
    +
  • +
+ +
\ No newline at end of file diff --git a/docs/api/sakugabooru-help-api.html b/docs/api/sakugabooru-help-api.html new file mode 100644 index 0000000..bc6c764 --- /dev/null +++ b/docs/api/sakugabooru-help-api.html @@ -0,0 +1,1009 @@ + + + + + sakugabooru + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+

Help: API 1.13.0+update.3

+ +
+

Moebooru offers API which is mostly compatible with Danbooru API (version 1.13.0) to make scripting easy. All you need is a way to GET and POST to URLs. The ability to parse XML or JSON responses is nice, but not critical. The simplicity of the API means you can write scripts using JavaScript, Perl, Python, Ruby, even shell languages like bash or tcsh.

+

Change Log | Posts | Tags | Artists | Comments | Wiki | Notes | Users | Forum | Pools

+
+ +
+
+

Basics

+

HTTP defines two request methods: GET and POST. You'll be using these two methods to interact with the Danbooru API. Most API calls that change the state of the database (like creating, updating, or deleting something) require an HTTP POST call. API calls that only retrieve data can typically be done with an HTTP GET call.

+

In the Danbooru API, a URL is analogous to a function name. You pass in the function parameters as a query string. Here's an extremely simple example: /post.xml?limit=1.

+

The post part indicates the controller we're working with. In this case it's posts. index describes the action. Here we're retrieving a list of posts. Finally, the xml part describes what format we want the response in. You can specify .xml for XML responses, .json for JSON responses, and nothing at all for HTML responses.

+
+ +
+

Responses

+

All API calls that change state will return a single element response (for XML calls). They are formatted like this:

+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <response success="false" reason="duplicate"/> +
+

For JSON responses, they'll look like this:

+
+ {success: false, reason: "duplicate"} +
+

While you can usually determine success or failure based on the response object, you can also figure out what happened based on the HTTP status code. In addition to the standard ones, Danbooru uses some custom status codes in the 4xx and 5xx range.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Status CodeMeaning
200 OKRequest was successful
403 ForbiddenAccess denied
404 Not FoundNot found
420 Invalid RecordRecord could not be saved
421 User ThrottledUser is throttled, try again later
422 LockedThe resource is locked and cannot be modified
423 Already ExistsResource already exists
424 Invalid ParametersThe given parameters were invalid
500 Internal Server ErrorSome unknown error occurred on the server
503 Service UnavailableServer cannot currently handle the request, try again later
+
+ +
+

JSON Responses

+

While you will probably want to work with XML in the majority of cases, if you're writing something in Javascript then the JSON responses may be preferable. They are much faster to parse and there's less code to write to get your data structure:

+
+ var data = JSON.parse(responseText)
+ alert(data.response) +
+
+ +
+

Logging In

+

Some actions may require you to log in. For any action you can always specify two parameters to identify yourself:

+
    +
  • login Your login name.
  • +
  • password_hash Your SHA1 hashed password. Simply hashing your plain password will NOT work since Danbooru salts its passwords. The actual string that is hashed is "er@!$rjiajd0$!dkaopc350!Y%)--your-password--".
  • +
+

Please be aware of the security risks involved in sending your password through an unencrypted channel. Although your password will be hashed, it is still theoretically possible for someone to steal your account by creating a fake cookie based on your hashed password.

+
+
+ + + +
+ +

Posts

+ +
+

List

+

The base URL is /post.xml.

+
    +
  • limit How many posts you want to retrieve. There is a hard limit of 100 posts per request.
  • +
  • page The page number.
  • +
  • tags The tags to search for. Any tag combination that works on the web site will work here. This includes all the meta-tags.
  • +
+
+ +
+

Create

+

The base URL is /post/create.xml. There are only two mandatory fields: you need to supply the tags, and you need to supply the file, either through a multipart form or through a source URL.

+
    +
  • post[tags] A space delimited list of tags.
  • +
  • post[file] The file data encoded as a multipart form.
  • +
  • post[rating] The rating for the post. Can be: safe, questionable, or explicit.
  • +
  • post[source] If this is a URL, Danbooru will download the file.
  • +
  • post[is_rating_locked] Set to true to prevent others from changing the rating.
  • +
  • post[is_note_locked] Set to true to prevent others from adding notes.
  • +
  • post[parent_id] The ID of the parent post.
  • +
  • md5 Supply an MD5 if you want Danbooru to verify the file after uploading. If the MD5 doesn't match, the post is destroyed.
  • +
+

If the call fails, the following response reasons are possible:

+
    +
  • MD5 mismatch This means you supplied an MD5 parameter and what Danbooru got doesn't match. Try uploading the file again.
  • +
  • duplicate This post already exists in Danbooru (based on the MD5 hash). An additional attribute called location will be set, pointing to the (relative) URL of the original post.
  • +
  • other Any other error will have its error message printed.
  • +
+

If the post upload succeeded, you'll get an attribute called location in the response pointing to the relative URL of your newly uploaded post.

+
+
+

Update

+

The base URL is /post/update.xml. Only the id parameter is required. Leave the other parameters blank if you don't want to change them.

+
    +
  • id The id number of the post to update.
  • +
  • post[tags] A space delimited list of tags.
  • +
  • post[file] The file data encoded as a multipart form.
  • +
  • post[rating] The rating for the post. Can be: safe, questionable, or explicit.
  • +
  • post[source] If this is a URL, Danbooru will download the file.
  • +
  • post[is_rating_locked] Set to true to prevent others from changing the rating.
  • +
  • post[is_note_locked] Set to true to prevent others from adding notes.
  • +
  • post[parent_id] The ID of the parent post.
  • +
+
+
+

Destroy

+

You must be logged in to use this action. You must also be the user who uploaded the post (or you must be a moderator).

+
    +
  • id The id number of the post to delete.
  • +
+
+
+

Revert Tags

+

This action reverts a post to a previous set of tags. The base URL is /post/revert_tags.xml.

+
    +
  • id The post id number to update.
  • +
  • history_id The id number of the tag history.
  • +
+
+
+

Vote

+

This action lets you vote for a post. You can only vote once per post per IP address. The base URL is /post/vote.xml.

+
    +
  • id The post id number to update.
  • +
  • score Set to 1 to vote up and -1 to vote down. All other values will be ignored.
  • +
+

If the call did not succeed, the following reasons are possible:

+
    +
  • already voted You have already voted for this post.
  • +
  • invalid score You have supplied an invalid score.
  • +
+
+
+ + + +
+ +

Tags

+ +
+

List

+

The base URL is /tag.xml.

+
    +
  • limit How many tags to retrieve. Setting this to 0 will return every tag.
  • +
  • page The page number.
  • +
  • order Can be date, count, or name.
  • +
  • id The id number of the tag.
  • +
  • after_id Return all tags that have an id number greater than this.
  • +
  • name The exact name of the tag.
  • +
  • name_pattern Search for any tag that has this parameter in its name.
  • +
+
+
+

Update

+

The base URL is /tag/update.xml.

+
    +
  • name The name of the tag to update.
  • +
  • tag[tag_type] The tag type. General: 0, artist: 1, copyright: 3, character: 4.
  • +
  • tag[is_ambiguous] Whether or not this tag is ambiguous. Use 1 for true and 0 for false.
  • +
+
+
+

Related

+

The base URL is /tag/related.xml.

+
    +
  • tags The tag names to query.
  • +
  • type Restrict results to this tag type (can be general, artist, copyright, or character).
  • +
+
+
+ + + +
+ +

Artists

+ +
+

List

+

The base URL is /artist.xml.

+
    +
  • name The name (or a fragment of the name) of the artist.
  • +
  • order Can be date or name.
  • +
  • page The page number.
  • +
+
+
+

Create

+

The base URL is /artist/create.xml.

+
    +
  • artist[name] The artist's name.
  • +
  • artist[urls] A list of URLs associated with the artist, whitespace delimited.
  • +
  • artist[alias] The artist that this artist is an alias for. Simply enter the alias artist's name.
  • +
  • artist[group] The group or cicle that this artist is a member of. Simply enter the group's name.
  • +
+
+
+

Update

+

The base URL is /artist/update.xml. Only the id parameter is required. The other parameters are optional.

+
    +
  • id The id of thr artist to update.
  • +
  • artist[name] The artist's name.
  • +
  • artist[urls] A list of URLs associated with the artist, whitespace delimited.
  • +
  • artist[alias] The artist that this artist is an alias for. Simply enter the alias artist's name.
  • +
  • artist[group] The group or cicle that this artist is a member of. Simply enter the group's name.
  • +
+
+
+

Destroy

+

The base URL is /artist/destroy.xml. You must be logged in to delete artists.

+
    +
  • id The id of the artist to destroy.
  • +
+
+
+ + + +
+ +

Comments

+ +
+

Show

+

The base URL is /comment/show.xml. This retrieves a single comment.

+
    +
  • id The id number of the comment to retrieve.
  • +
+
+ +
+

Create

+

The base URL is /comment/create.xml.

+
    +
  • comment[anonymous] Set to 1 if you want to post this comment anonymously.
  • +
  • comment[post_id] The post id number to which you are responding.
  • +
  • comment[body] The body of the comment.
  • +
+
+ +
+

Destroy

+

The base url is /comment/destroy.xml. You must be logged in to use this action. You must also be the owner of the comment, or you must be a moderator.

+
    +
  • id The id number of the comment to delete.
  • +
+
+
+ + + +
+ +

Wiki

+

All titles must be exact (but case and whitespace don't matter).

+ +
+

List

+

The base URL is /wiki.xml. This retrieves a list of every wiki page.

+
    +
  • order How you want the pages ordered. Can be: title, date.
  • +
  • limit The number of pages to retrieve.
  • +
  • page The page number.
  • +
  • query A word or phrase to search for.
  • +
+
+ +
+

Create

+

The base URL is /wiki/create.xml.

+
    +
  • wiki_page[title] The title of the wiki page.
  • +
  • wiki_page[body] The body of the wiki page.
  • +
+
+ +
+

Update

+

The base URL is /wiki/update.xml. Potential error reasons: "Page is locked"

+
    +
  • title The title of the wiki page to update.
  • +
  • wiki_page[title] The new title of the wiki page.
  • +
  • wiki_page[body] The new body of the wiki page.
  • +
+
+ +
+

Show

+

The base URL is /wiki/show.xml. Potential error reasons: "artist type"

+
    +
  • title The title of the wiki page to retrieve.
  • +
  • version The version of the page to retrieve.
  • +
+
+ +
+

Destroy

+

The base URL is /wiki/destroy.xml. You must be logged in as a moderator to use this action.

+
    +
  • title The title of the page to delete.
  • +
+
+ +
+

Lock

+

The base URL is /wiki/lock.xml. You must be logged in as a moderator to use this action.

+
    +
  • title The title of the page to lock.
  • +
+
+ +
+

Unlock

+

The base URL is /wiki/unlock.xml. You must be logged in as a moderator to use this action.

+
    +
  • title The title of the page to unlock.
  • +
+
+ +
+

Revert

+

The base URL is /wiki/revert.xml. Potential error reasons: "Page is locked"

+
    +
  • title The title of the wiki page to update.
  • +
  • version The version to revert to.
  • +
+
+ +
+

History

+

The base URL is /wiki/history.xml.

+
    +
  • title The title of the wiki page to retrieve versions for.
  • +
+
+
+ + + +
+ +

Notes

+ +
+

List

+

The base URL is /note.xml.

+
    +
  • post_id The post id number to retrieve notes for.
  • +
+
+ +
+

Search

+

The base URL is /note/search.xml.

+
    +
  • query A word or phrase to search for.
  • +
+
+ +
+

History

+

The base URL is /note/history.xml. You can either specify id, post_id, or nothing. Specifying nothing will give you a list of every note verison.

+
    +
  • limit How many versions to retrieve.
  • +
  • page The offset.
  • +
  • post_id The post id number to retrieve note versions for.
  • +
  • id The note id number to retrieve versions for.
  • +
+
+ +
+

Revert

+

The base URL is /note/revert.xml. Potential error reasons: "Post is locked"

+
    +
  • id The note id to update.
  • +
  • version The version to revert to.
  • +
+
+ +
+

Create/Update

+

The base URL is /note/update.xml. Notes differ from the other controllers in that the interface for creation and updates is the same. If you supply an id parameter, then Danbooru will assume you're updating an existing note. Otherwise, it will create a new note. Potential error reasons: "Post is locked"

+
    +
  • id If you are updating a note, this is the note id number to update.
  • +
  • note[post_id] The post id number this note belongs to.
  • +
  • note[x] The x coordinate of the note.
  • +
  • note[y] The y coordinate of the note.
  • +
  • note[width] The width of the note.
  • +
  • note[height] The height of the note.
  • +
  • note[is_active] Whether or not the note is visible. Set to 1 for active, 0 for inactive.
  • +
  • note[body] The note message.
  • +
+
+
+ + + +
+ +

Users

+ +
+

Search

+

The base URL is /user.xml. If you don't specify any parameters you'll get a listing of all users.

+
    +
  • id The id number of the user.
  • +
  • name The name of the user.
  • +
+
+
+ + + +
+ +

Forum

+ +
+

List

+

The base URL is /forum.xml. If you don't specify any parameters you'll get a list of all the parent topics.

+
    +
  • parent_id The parent ID number. You'll return all the responses to that forum post.
  • +
+
+
+ + + +
+ +

Pools

+ +
+

List Pools

+

The base URL is /pool.xml. If you don't specify any parameters you'll get a list of all pools.

+
    +
  • query The title.
  • +
  • page The page.
  • +
+
+ +
+

List Posts

+

The base URL is /pool/show.xml. If you don't specify any parameters you'll get a list of all pools.

+
    +
  • id The pool id number.
  • +
  • page The page.
  • +
+
+ +
+

Update

+

The base URL is /pool/update.xml.

+
    +
  • id The pool id number.
  • +
  • pool[name] The name.
  • +
  • pool[is_public] 1 or 0, whether or not the pool is public.
  • +
  • pool[description] A description of the pool.
  • +
+
+ +
+

Create

+

The base URL is /pool/create.xml.

+
    +
  • pool[name] The name.
  • +
  • pool[is_public] 1 or 0, whether or not the pool is public.
  • +
  • pool[description] A description of the pool.
  • +
+
+ +
+

Destroy

+

The base URL is /pool/destroy.xml.

+
    +
  • id The pool id number.
  • +
+
+ +
+

Add Post

+

The base URL is /pool/add_post.xml. Potential error reasons: "Post already exists", "access denied"

+
    +
  • pool_id The pool to add the post to.
  • +
  • post_id The post to add.
  • +
+
+ +
+

Remove Post

+

The base URL is /pool/remove_post.xml. Potential error reasons: "access denied"

+
    +
  • pool_id The pool to remove the post from.
  • +
  • post_id The post to remove.
  • +
+
+ +
+ + + +
+ +

Favorites

+ +
+

List Users

+

The base URL is /favorite/list_users.json. There is no XML API for this action.

+
    +
  • id The post id.
  • +
+
+
+ + + +
+ +

Change Log

+
+

2.0.0

+
    +
  • Removed blacklist_tags from user object (never documented)
  • +
  • XML tag for user API has been changed from post to user
  • +
+

1.13.0+update.3

+
    +
  • Removed /index from API URLs
  • +
+

1.13.0+update.2

+
    +
  • Readd favorite/list_users API
  • +
+

1.13.0+update.1

+
    +
  • Added documentation for pools
  • +
+ +

1.13.0

+
    +
  • Changed interface for artists to use new URL system
  • +
  • JSON requests now end in a .json suffix
  • +
  • Renamed some error reason messages
  • +
  • Removed comment/index from API
  • +
  • Removed url and md5 parameters from artist search (can just pass the URL or MD5 hash to the name parameter)
  • +
+
+ +
+

1.8.1

+
    +
  • Removed post[is_flagged] attribute
  • +
+
+
+
+ + + +
+ + + + + + + + + diff --git a/docs/api/yandere-help-api.html b/docs/api/yandere-help-api.html new file mode 100644 index 0000000..d8f02e0 --- /dev/null +++ b/docs/api/yandere-help-api.html @@ -0,0 +1,1021 @@ + + + + + yande.re + + + + + + + + + + + + + + + + + + + + + + + + + +
+
    +
  • Try clearing out cookies of you have problem logging in/out.
  • +
+ + Close +
+ + + + + + + + + + + + + + + + + +
+
+

Help: API 1.13.0+update.3

+ +
+

Moebooru offers API which is mostly compatible with Danbooru API (version 1.13.0) to make scripting easy. All you need is a way to GET and POST to URLs. The ability to parse XML or JSON responses is nice, but not critical. The simplicity of the API means you can write scripts using JavaScript, Perl, Python, Ruby, even shell languages like bash or tcsh.

+

Change Log | Posts | Tags | Artists | Comments | Wiki | Notes | Users | Forum | Pools

+
+ +
+
+

Basics

+

HTTP defines two request methods: GET and POST. You'll be using these two methods to interact with the Danbooru API. Most API calls that change the state of the database (like creating, updating, or deleting something) require an HTTP POST call. API calls that only retrieve data can typically be done with an HTTP GET call.

+

In the Danbooru API, a URL is analogous to a function name. You pass in the function parameters as a query string. Here's an extremely simple example: /post.xml?limit=1.

+

The post part indicates the controller we're working with. In this case it's posts. index describes the action. Here we're retrieving a list of posts. Finally, the xml part describes what format we want the response in. You can specify .xml for XML responses, .json for JSON responses, and nothing at all for HTML responses.

+
+ +
+

Responses

+

All API calls that change state will return a single element response (for XML calls). They are formatted like this:

+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <response success="false" reason="duplicate"/> +
+

For JSON responses, they'll look like this:

+
+ {success: false, reason: "duplicate"} +
+

While you can usually determine success or failure based on the response object, you can also figure out what happened based on the HTTP status code. In addition to the standard ones, Danbooru uses some custom status codes in the 4xx and 5xx range.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Status CodeMeaning
200 OKRequest was successful
403 ForbiddenAccess denied
404 Not FoundNot found
420 Invalid RecordRecord could not be saved
421 User ThrottledUser is throttled, try again later
422 LockedThe resource is locked and cannot be modified
423 Already ExistsResource already exists
424 Invalid ParametersThe given parameters were invalid
500 Internal Server ErrorSome unknown error occurred on the server
503 Service UnavailableServer cannot currently handle the request, try again later
+
+ +
+

JSON Responses

+

While you will probably want to work with XML in the majority of cases, if you're writing something in Javascript then the JSON responses may be preferable. They are much faster to parse and there's less code to write to get your data structure:

+
+ var data = JSON.parse(responseText)
+ alert(data.response) +
+
+ +
+

Logging In

+

Some actions may require you to log in. For any action you can always specify two parameters to identify yourself:

+
    +
  • login Your login name.
  • +
  • password_hash Your SHA1 hashed password. Simply hashing your plain password will NOT work since Danbooru salts its passwords. The actual string that is hashed is "choujin-steiner--your-password--".
  • +
+

Please be aware of the security risks involved in sending your password through an unencrypted channel. Although your password will be hashed, it is still theoretically possible for someone to steal your account by creating a fake cookie based on your hashed password.

+
+
+ + + +
+ +

Posts

+ +
+

List

+

The base URL is /post.xml.

+
    +
  • limit How many posts you want to retrieve. There is a hard limit of 100 posts per request.
  • +
  • page The page number.
  • +
  • tags The tags to search for. Any tag combination that works on the web site will work here. This includes all the meta-tags.
  • +
+
+ +
+

Create

+

The base URL is /post/create.xml. There are only two mandatory fields: you need to supply the tags, and you need to supply the file, either through a multipart form or through a source URL.

+
    +
  • post[tags] A space delimited list of tags.
  • +
  • post[file] The file data encoded as a multipart form.
  • +
  • post[rating] The rating for the post. Can be: safe, questionable, or explicit.
  • +
  • post[source] If this is a URL, Danbooru will download the file.
  • +
  • post[is_rating_locked] Set to true to prevent others from changing the rating.
  • +
  • post[is_note_locked] Set to true to prevent others from adding notes.
  • +
  • post[parent_id] The ID of the parent post.
  • +
  • md5 Supply an MD5 if you want Danbooru to verify the file after uploading. If the MD5 doesn't match, the post is destroyed.
  • +
+

If the call fails, the following response reasons are possible:

+
    +
  • MD5 mismatch This means you supplied an MD5 parameter and what Danbooru got doesn't match. Try uploading the file again.
  • +
  • duplicate This post already exists in Danbooru (based on the MD5 hash). An additional attribute called location will be set, pointing to the (relative) URL of the original post.
  • +
  • other Any other error will have its error message printed.
  • +
+

If the post upload succeeded, you'll get an attribute called location in the response pointing to the relative URL of your newly uploaded post.

+
+
+

Update

+

The base URL is /post/update.xml. Only the id parameter is required. Leave the other parameters blank if you don't want to change them.

+
    +
  • id The id number of the post to update.
  • +
  • post[tags] A space delimited list of tags.
  • +
  • post[file] The file data encoded as a multipart form.
  • +
  • post[rating] The rating for the post. Can be: safe, questionable, or explicit.
  • +
  • post[source] If this is a URL, Danbooru will download the file.
  • +
  • post[is_rating_locked] Set to true to prevent others from changing the rating.
  • +
  • post[is_note_locked] Set to true to prevent others from adding notes.
  • +
  • post[parent_id] The ID of the parent post.
  • +
+
+
+

Destroy

+

You must be logged in to use this action. You must also be the user who uploaded the post (or you must be a moderator).

+
    +
  • id The id number of the post to delete.
  • +
+
+
+

Revert Tags

+

This action reverts a post to a previous set of tags. The base URL is /post/revert_tags.xml.

+
    +
  • id The post id number to update.
  • +
  • history_id The id number of the tag history.
  • +
+
+
+

Vote

+

This action lets you vote for a post. You can only vote once per post per IP address. The base URL is /post/vote.xml.

+
    +
  • id The post id number to update.
  • +
  • score Set to 1 to vote up and -1 to vote down. All other values will be ignored.
  • +
+

If the call did not succeed, the following reasons are possible:

+
    +
  • already voted You have already voted for this post.
  • +
  • invalid score You have supplied an invalid score.
  • +
+
+
+ + + +
+ +

Tags

+ +
+

List

+

The base URL is /tag.xml.

+
    +
  • limit How many tags to retrieve. Setting this to 0 will return every tag.
  • +
  • page The page number.
  • +
  • order Can be date, count, or name.
  • +
  • id The id number of the tag.
  • +
  • after_id Return all tags that have an id number greater than this.
  • +
  • name The exact name of the tag.
  • +
  • name_pattern Search for any tag that has this parameter in its name.
  • +
+
+
+

Update

+

The base URL is /tag/update.xml.

+
    +
  • name The name of the tag to update.
  • +
  • tag[tag_type] The tag type. General: 0, artist: 1, copyright: 3, character: 4.
  • +
  • tag[is_ambiguous] Whether or not this tag is ambiguous. Use 1 for true and 0 for false.
  • +
+
+
+

Related

+

The base URL is /tag/related.xml.

+
    +
  • tags The tag names to query.
  • +
  • type Restrict results to this tag type (can be general, artist, copyright, or character).
  • +
+
+
+ + + +
+ +

Artists

+ +
+

List

+

The base URL is /artist.xml.

+
    +
  • name The name (or a fragment of the name) of the artist.
  • +
  • order Can be date or name.
  • +
  • page The page number.
  • +
+
+
+

Create

+

The base URL is /artist/create.xml.

+
    +
  • artist[name] The artist's name.
  • +
  • artist[urls] A list of URLs associated with the artist, whitespace delimited.
  • +
  • artist[alias] The artist that this artist is an alias for. Simply enter the alias artist's name.
  • +
  • artist[group] The group or cicle that this artist is a member of. Simply enter the group's name.
  • +
+
+
+

Update

+

The base URL is /artist/update.xml. Only the id parameter is required. The other parameters are optional.

+
    +
  • id The id of thr artist to update.
  • +
  • artist[name] The artist's name.
  • +
  • artist[urls] A list of URLs associated with the artist, whitespace delimited.
  • +
  • artist[alias] The artist that this artist is an alias for. Simply enter the alias artist's name.
  • +
  • artist[group] The group or cicle that this artist is a member of. Simply enter the group's name.
  • +
+
+
+

Destroy

+

The base URL is /artist/destroy.xml. You must be logged in to delete artists.

+
    +
  • id The id of the artist to destroy.
  • +
+
+
+ + + +
+ +

Comments

+ +
+

Show

+

The base URL is /comment/show.xml. This retrieves a single comment.

+
    +
  • id The id number of the comment to retrieve.
  • +
+
+ +
+

Create

+

The base URL is /comment/create.xml.

+
    +
  • comment[anonymous] Set to 1 if you want to post this comment anonymously.
  • +
  • comment[post_id] The post id number to which you are responding.
  • +
  • comment[body] The body of the comment.
  • +
+
+ +
+

Destroy

+

The base url is /comment/destroy.xml. You must be logged in to use this action. You must also be the owner of the comment, or you must be a moderator.

+
    +
  • id The id number of the comment to delete.
  • +
+
+
+ + + +
+ +

Wiki

+

All titles must be exact (but case and whitespace don't matter).

+ +
+

List

+

The base URL is /wiki.xml. This retrieves a list of every wiki page.

+
    +
  • order How you want the pages ordered. Can be: title, date.
  • +
  • limit The number of pages to retrieve.
  • +
  • page The page number.
  • +
  • query A word or phrase to search for.
  • +
+
+ +
+

Create

+

The base URL is /wiki/create.xml.

+
    +
  • wiki_page[title] The title of the wiki page.
  • +
  • wiki_page[body] The body of the wiki page.
  • +
+
+ +
+

Update

+

The base URL is /wiki/update.xml. Potential error reasons: "Page is locked"

+
    +
  • title The title of the wiki page to update.
  • +
  • wiki_page[title] The new title of the wiki page.
  • +
  • wiki_page[body] The new body of the wiki page.
  • +
+
+ +
+

Show

+

The base URL is /wiki/show.xml. Potential error reasons: "artist type"

+
    +
  • title The title of the wiki page to retrieve.
  • +
  • version The version of the page to retrieve.
  • +
+
+ +
+

Destroy

+

The base URL is /wiki/destroy.xml. You must be logged in as a moderator to use this action.

+
    +
  • title The title of the page to delete.
  • +
+
+ +
+

Lock

+

The base URL is /wiki/lock.xml. You must be logged in as a moderator to use this action.

+
    +
  • title The title of the page to lock.
  • +
+
+ +
+

Unlock

+

The base URL is /wiki/unlock.xml. You must be logged in as a moderator to use this action.

+
    +
  • title The title of the page to unlock.
  • +
+
+ +
+

Revert

+

The base URL is /wiki/revert.xml. Potential error reasons: "Page is locked"

+
    +
  • title The title of the wiki page to update.
  • +
  • version The version to revert to.
  • +
+
+ +
+

History

+

The base URL is /wiki/history.xml.

+
    +
  • title The title of the wiki page to retrieve versions for.
  • +
+
+
+ + + +
+ +

Notes

+ +
+

List

+

The base URL is /note.xml.

+
    +
  • post_id The post id number to retrieve notes for.
  • +
+
+ +
+

Search

+

The base URL is /note/search.xml.

+
    +
  • query A word or phrase to search for.
  • +
+
+ +
+

History

+

The base URL is /note/history.xml. You can either specify id, post_id, or nothing. Specifying nothing will give you a list of every note verison.

+
    +
  • limit How many versions to retrieve.
  • +
  • page The offset.
  • +
  • post_id The post id number to retrieve note versions for.
  • +
  • id The note id number to retrieve versions for.
  • +
+
+ +
+

Revert

+

The base URL is /note/revert.xml. Potential error reasons: "Post is locked"

+
    +
  • id The note id to update.
  • +
  • version The version to revert to.
  • +
+
+ +
+

Create/Update

+

The base URL is /note/update.xml. Notes differ from the other controllers in that the interface for creation and updates is the same. If you supply an id parameter, then Danbooru will assume you're updating an existing note. Otherwise, it will create a new note. Potential error reasons: "Post is locked"

+
    +
  • id If you are updating a note, this is the note id number to update.
  • +
  • note[post_id] The post id number this note belongs to.
  • +
  • note[x] The x coordinate of the note.
  • +
  • note[y] The y coordinate of the note.
  • +
  • note[width] The width of the note.
  • +
  • note[height] The height of the note.
  • +
  • note[is_active] Whether or not the note is visible. Set to 1 for active, 0 for inactive.
  • +
  • note[body] The note message.
  • +
+
+
+ + + +
+ +

Users

+ +
+

Search

+

The base URL is /user.xml. If you don't specify any parameters you'll get a listing of all users.

+
    +
  • id The id number of the user.
  • +
  • name The name of the user.
  • +
+
+
+ + + +
+ +

Forum

+ +
+

List

+

The base URL is /forum.xml. If you don't specify any parameters you'll get a list of all the parent topics.

+
    +
  • parent_id The parent ID number. You'll return all the responses to that forum post.
  • +
+
+
+ + + +
+ +

Pools

+ +
+

List Pools

+

The base URL is /pool.xml. If you don't specify any parameters you'll get a list of all pools.

+
    +
  • query The title.
  • +
  • page The page.
  • +
+
+ +
+

List Posts

+

The base URL is /pool/show.xml. If you don't specify any parameters you'll get a list of all pools.

+
    +
  • id The pool id number.
  • +
  • page The page.
  • +
+
+ +
+

Update

+

The base URL is /pool/update.xml.

+
    +
  • id The pool id number.
  • +
  • pool[name] The name.
  • +
  • pool[is_public] 1 or 0, whether or not the pool is public.
  • +
  • pool[description] A description of the pool.
  • +
+
+ +
+

Create

+

The base URL is /pool/create.xml.

+
    +
  • pool[name] The name.
  • +
  • pool[is_public] 1 or 0, whether or not the pool is public.
  • +
  • pool[description] A description of the pool.
  • +
+
+ +
+

Destroy

+

The base URL is /pool/destroy.xml.

+
    +
  • id The pool id number.
  • +
+
+ +
+

Add Post

+

The base URL is /pool/add_post.xml. Potential error reasons: "Post already exists", "access denied"

+
    +
  • pool_id The pool to add the post to.
  • +
  • post_id The post to add.
  • +
+
+ +
+

Remove Post

+

The base URL is /pool/remove_post.xml. Potential error reasons: "access denied"

+
    +
  • pool_id The pool to remove the post from.
  • +
  • post_id The post to remove.
  • +
+
+ +
+ + + +
+ +

Favorites

+ +
+

List Users

+

The base URL is /favorite/list_users.json. There is no XML API for this action.

+
    +
  • id The post id.
  • +
+
+
+ + + +
+ +

Change Log

+
+

2.0.0

+
    +
  • Removed blacklist_tags from user object (never documented)
  • +
  • XML tag for user API has been changed from post to user
  • +
+

1.13.0+update.3

+
    +
  • Removed /index from API URLs
  • +
+

1.13.0+update.2

+
    +
  • Readd favorite/list_users API
  • +
+

1.13.0+update.1

+
    +
  • Added documentation for pools
  • +
+ +

1.13.0

+
    +
  • Changed interface for artists to use new URL system
  • +
  • JSON requests now end in a .json suffix
  • +
  • Renamed some error reason messages
  • +
  • Removed comment/index from API
  • +
  • Removed url and md5 parameters from artist search (can just pass the URL or MD5 hash to the name parameter)
  • +
+
+ +
+

1.8.1

+
    +
  • Removed post[is_flagged] attribute
  • +
+
+
+
+ + + +
+ + + + + +
+ + +
+ + + + diff --git a/docs/plans/2026-02-23-held-posts-toggle-design.md b/docs/plans/2026-02-23-held-posts-toggle-design.md new file mode 100644 index 0000000..b629f0f --- /dev/null +++ b/docs/plans/2026-02-23-held-posts-toggle-design.md @@ -0,0 +1,29 @@ +# Held Posts Toggle Design + +## Goal +Add a user setting that allows Moebooru providers to include held posts in the feed when desired, while preserving current default ordering behavior. + +## Problem +Konachan and yande.re API results can diverge from website ordering because held posts are included unless explicitly filtered. We currently force `holds:false` by default to match the website feed, but users need an option to view held posts. + +## Decision +Implement a global persisted setting: `showHeldMoebooruPosts` (default `false`). + +- When `false`: Moebooru requests continue to append `holds:false` unless user already provides `holds:*`. +- When `true`: Moebooru requests do not add a default `holds:false` filter; explicit `holds:*` tags still win. + +## Scope +- Data model: Add `@AppStorage` boolean to `SettingsManager`. +- Networking: Thread the setting into `BooruManager` and its Moebooru tag helper. +- UI: Add a toggle in Provider settings. +- Wiring: Rebuild `BooruManager` when setting changes so feed refresh reflects the new mode. +- Tests: Add source-based checks for setting persistence, manager wiring, and Moebooru filter behavior. + +## Non-Goals +- Per-provider held-post settings. +- Changing Danbooru/Gelbooru behavior. +- Advanced moderation controls beyond `holds:*` behavior. + +## Rollout Behavior +- Existing users default to `false`, preserving current website-aligned feed order. +- Users can opt in to include held posts through settings. diff --git a/docs/plans/2026-02-23-held-posts-toggle-implementation.md b/docs/plans/2026-02-23-held-posts-toggle-implementation.md new file mode 100644 index 0000000..7f84e55 --- /dev/null +++ b/docs/plans/2026-02-23-held-posts-toggle-implementation.md @@ -0,0 +1,68 @@ +# Held Posts Toggle Implementation Plan + +> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. + +**Goal:** Add a settings toggle to allow showing held posts on Moebooru providers, while keeping default feed behavior aligned with website ordering. + +**Architecture:** Persist a global boolean in `SettingsManager`, pass it into `BooruManager`, and conditionally apply default `holds:false` in the Moebooru tag helper. Expose the toggle in Provider settings and rebuild manager instances when the setting changes so requests immediately reflect the new behavior. + +**Tech Stack:** Swift, SwiftUI, `@AppStorage`, XCTest source-assertion tests. + +--- + +### Task 1: Add failing tests for toggle persistence and wiring + +**Files:** +- Modify: `SoraTests/ViewDerivedDataTests.swift` + +**Step 1: Write failing tests** +- Add a test asserting `SettingsManager` contains `@AppStorage("showHeldMoebooruPosts") var showHeldMoebooruPosts = false`. +- Add a test asserting `MainView` passes `showHeldMoebooruPosts: settings.showHeldMoebooruPosts` when creating `BooruManager`. +- Add a test asserting `BooruManager.moebooruTagString` guards on `showHeldMoebooruPosts` and bypasses forced `holds:false` when enabled. + +**Step 2: Run tests to verify failure** +- Run: `xcodebuild -scheme Sora -destination 'platform=iOS Simulator,name=iPhone 17,OS=26.2' -only-testing:SoraTests/ViewDerivedDataTests test` +- Expected: New tests fail due missing setting/wiring. + +### Task 2: Implement the setting and manager behavior + +**Files:** +- Modify: `Sora/Data/Settings/SettingsManager.swift` +- Modify: `Sora/Data/Booru/BooruManager.swift` +- Modify: `Sora/Views/MainView.swift` +- Modify: `Sora/Views/Settings/Section/SettingsSectionProviderView.swift` + +**Step 1: Add setting storage** +- Add `@AppStorage("showHeldMoebooruPosts") var showHeldMoebooruPosts = false` to `SettingsManager`. + +**Step 2: Thread setting into manager** +- Add `showHeldMoebooruPosts` init param + stored property in `BooruManager`. +- Update Moebooru tag helper: + - Respect explicit `holds:*` as-is. + - If `showHeldMoebooruPosts == true`, return raw tags (no forced filter). + - Else append `holds:false` default. + +**Step 3: Wire manager creation points** +- Update `MainView` manager constructors to pass `showHeldMoebooruPosts: settings.showHeldMoebooruPosts`. +- Add `.onChange(of: settings.showHeldMoebooruPosts)` to rebuild manager and refresh feed. + +**Step 4: Expose toggle in settings UI** +- Add `Toggle("Show Held Posts", isOn: $settings.showHeldMoebooruPosts)` to Provider settings section. +- Add concise help text that this affects Moebooru feeds. + +### Task 3: Verify and finalize + +**Files:** +- Modify (if needed): `SoraTests/ViewDerivedDataTests.swift` + +**Step 1: Run targeted tests** +- Run: `xcodebuild -scheme Sora -destination 'platform=iOS Simulator,name=iPhone 17,OS=26.2' -only-testing:SoraTests/ViewDerivedDataTests test` +- Expected: PASS. + +**Step 2: Run lint** +- Run: `swiftlint lint --quiet` +- Expected: PASS. + +**Step 3: Summarize behavior** +- Confirm default (`false`) preserves website-aligned ordering. +- Confirm toggle (`true`) includes held posts for Moebooru providers. -- cgit v1.2.3