Danbooru

API documentation is missing a section on tags

Posted under General

The API documentation at wiki #43568 has a section on every important entity on Danbooru, including tag aliases and tag implications, but there is no section for tags, which is somehow omitted.

The top of the page has an example about querying tags, which suggests that the omission is accidental.

Also, the API does not seem to be returning correct results. The documentation says:

Some resources require parameters. For example, you can search for tags named abc by calling GET /tags.json?search[name_matches]=abc. This will give you a JSON listing of all tags with name abc.

Wildcards seem to be allowed, as they were under the old API. For example, http://danbooru.donmai.us/tags.json?search[name_matches]=*elf finds the tags "elf", "nixelf", "watering_elf", and so on. but it does not find the tag bookshelf.

Am I doing something wrong?

meatwagon said:

Wildcards seem to be allowed, as they were under the old API. For example, http://danbooru.donmai.us/tags.json?search[name_matches]=*elf finds the tags "elf", "nixelf", "watering_elf", and so on. but it does not find the tag bookshelf.

Bookshelf is on the second page. The first page only returns the first 20 results by default. The default order when unspecified is most recently created tags first.

To get bookshelf, you can do any of the following:

  • Go to the second page, by appending &page=2
  • Specify an order like &search[order]=count, which will result in the larger tags like bookshelf appearing first
  • Increase the number of results displayed on each page, e.g. with &limit=50 (max limit is 1000 but I'm not sure you should go that high)

Note that the parameters the api takes are identical to the parameters the html version takes. If you go to /tags?search[name_matches]=*elf you'll also notice that bookshelf appears on the second page.

meatwagon said:

The API documentation at wiki #43568 has a section on every important entity on Danbooru, including tag aliases and tag implications, but there is no section for tags, which is somehow omitted.

The top of the page has an example about querying tags, which suggests that the omission is accidental.

Added the tags section

1