Topic: API questions

Posted under e621 Tools and Applications

1. Do I need to auth for posts.json and pools.json?

1.a. If no, why some images (but not all*) are returning NULL urls in JSON when I try to get via php but returns the correct url if I do the same on browser?

Let's use this url for example: https://e621.net/posts/16691.json?pool_id=12

If I grab it using my php script, $json->post->file->url will return NULL.

But if I grab it on browser and replace the contents of the .json cache, It'll return https://static1.e621.net/data/0d/84/0d8484c9a025b7a629b4877046b0af39.jpg.

(*older images returns null, newer returns the actual url)

1.b. If yes, how are people supposed to use other people's apps? Using their own api key?

1.b.1. How do I auth? 'header' => "Authorization: Basic " . base64_encode("$username:$password") ?

2. If I'm trying to download a 300 images comic, is it bad? Can I do it if it isn't very often?

1. tldr; no
But there is the new global blacklist for anon user (explained quite well here (Will hopefully get an official workaround in a few weeks)).
Because of that you are getting url = null, you can either use your API key:
- Get it under Account > Api Key
- Add it to every api call as parameter api_key
Another way would be to reconstruct the image link: explained here

1.b Basically yes, see "Logging in" on help:api

2. Why not, just keep the rate limit in mind (max. 2 requests per second) and if time is not important, just do something like only 1 request per 2 seconds, to be nice.

Also you can always help by expanding the API documentation, not only with prior undocumented endpoints, but also with tips for certain calls. help:api

That global blacklist is pretty annoying, I thought I was doing something wrong. If I don't need to log in and reconstructing the url isn't illegal, I think I'll keep the workaround.

About the 2 req per second, I'll put a 0.75s sleep once I finish it. (for now, I'm using a 3 or 5 images pool to test)

tilcreator said:
Also you can always help by expanding the API documentation, not only with prior undocumented endpoints, but also with tips for certain calls. help:api

My english skills are pretty bad, and gets even worse if I try to write tech stuff. I'll probably get banned for vandalism if I try to edit that. lol

btw, thank you . =)

btw2... whoever rewrote this API is my new hero. Way easier to work with. Older would spit a 10MB data to work with... lol

nsfw said:
That global blacklist is pretty annoying, I thought I was doing something wrong. If I don't need to log in and reconstructing the url isn't illegal, I think I'll keep the workaround.

About the 2 req per second, I'll put a 0.75s sleep once I finish it. (for now, I'm using a 3 or 5 images pool to test)

My english skills are pretty bad, and gets even worse if I try to write tech stuff. I'll probably get banned for vandalism if I try to edit that. lol

btw, thank you . =)

btw2... whoever rewrote this API is my new hero. Way easier to work with. Older would spit a 10MB data to work with... lol

2 requests/sec is the hard limit. It's preferred to keep at 1/sec.

  • 1