Gelbooru

Notice: We are now selling NEW Gelbooru Merch~! Domestic shipping is free on all orders! International shipping free for a very limited time! Do you have an artist tag on Gelbooru? Let us know so we can properly credit you!

Ticket Information - ID: #921


ID:Category:SeverityReproducibilityDate SubmittedUpdated By:
0000921Feature RequestnormalN/A01/05/18 08:25AMJerl
ReporterSomeCock
Assigned to:geltas
Resolution:Open
View StatusPublic
Version:
Target Version:N/A
Summary:[API] Need more data in JSON formatted response.
Description:In JSON formatted response not enough data. It would be nice to get in the response:
Sample_url (is in XML)
File_size in bytes
Sample_size in bytes

And REALLY cool if like on danbooru separate tags
tag_string_general
tag_string_character
tag_string_copyright
tag_string_artist
tag_string_meta
Additional Info:
Jerl replied at 2018-01-06 09:38:44
The JSON API has all the information that the XML API has.

The API is already a very major part of our CPU usage, and has often caused significant slowdowns for the site when it gets hit hard. Currently, the way the API works only requires one search index query per page, which is pretty efficient. However, since tag types are NOT stored in post data but rather their own separate table, putting tag types in the API output would require additional database queries, which are significantly harder on the server than search index queries. It's technically feasible to implement, but in practice will probably significantly slow the site down.

Adding tag type information to post data would require for the site to be taken down for potentially up to several days.

SomeCock replied at 2018-01-08 09:19:51
Thanks for the answer,
>>Jerl replied at 2018-01-06 09:38:44
The JSON API has all the information that the XML API has.

How can i take sample_url in json?
For example
https://gelbooru.com/index.php?page=dapi&s=post&q=index&json=1&id=4048855


[
{
"source": "",
"directory": "c3/b1",
"hash": "c3b1dbe290b0d133a98f0a7d498e86f5",
"height": 2151,
"id": 4048855,
"image": "c3b1dbe290b0d133a98f0a7d498e86f5.jpg",
"change": 1515423683,
"owner": "danbooru",
"parent_id": null,
"rating": "s",
"sample": true,
"sample_height": 585,
"sample_width": 850,
"score": 0,
"tags": *Some tags*,
"width": 3126,
"file_url": "https://simg3.gelbooru.com/images/c3/b1/c3b1dbe290b0d133a98f0a7d498e86f5.jpg"
}
]

And,
https://gelbooru.com/index.php?page=dapi&s=post&q=index&id=4048855

<?xml version="1.0" encoding="UTF-8" ?>
<posts count="1"offset="0">
<post
height="2151"
score="0"
file_url="https://simg3.gelbooru.com/images/c3/b1/c3b1dbe290b0d133a98f0a7d498e86f5.jpg"
parent_id=""
sample_url="https://simg3.gelbooru.com/samples/c3/b1/sample_c3b1dbe290b0d133a98f0a7d498e86f5.jpg"
sample_width="850"
sample_height="585"
preview_url="https://simg3.gelbooru.com/thumbnails/c3/b1/thumbnail_c3b1dbe290b0d133a98f0a7d498e86f5.jpg"
rating="s"
tags= *Some tags*
id="4048855"
width="3126"
change="1515423683"
md5="c3b1dbe290b0d133a98f0a7d498e86f5"
creator_id="6498"
has_children="false"
created_at="Mon Jan 08 09:01:22 -0600 2018"
status="active"
source="https://twitter.com/rei_RR/status/949601674775076865"
has_notes="false"
has_comments="false"
preview_width="150"
preview_height="103"/>
</posts>

Sorry if i am little bit retard)

SomeCock replied at 2018-01-08 09:24:04
Ok, i am retard, i can just add "/samples/.../sample_"
Sorry...

SomeCock replied at 2018-01-08 10:36:54
Lol, but sometime sample have another file extension and just "/samples/.../sample_" not help

lozertuser replied at 2018-01-09 04:55:11
Samples will always be .jpg.

cojoc07 replied at 2018-01-20 09:44:27
How about adding the _(artist) string at the end of each artist tag?

Jerl replied at 2018-01-21 02:16:04
Tag types aren't stored in the post table, and therefore not stored in Solr. We'd have to do a separate database lookup for tag type information, which would add a considerable amount of extra load to the API. The API is already one of our biggest sources of load, so that could cause the site to be significantly slowed down. Adding that information to the post table would require at least several days of downtime (or at least read-only mode) to process.