Topic: How exactly do you use the api?

Posted under e621 Tools and Applications

I have been trying to learn how to use the e621 API, but I find the guide confusing. I'm trying to use the GET method to find the urls for posts that usually show up when using the website, and I am having trouble doing that since I am not accustomed to the syntax and url queries in general.

I want to get the first 15 or so posts that have certain tags, say "horse male -female" is what I would type into the search bar. I want to know what I should type with me GET requests to see the same results I would get if I typed that into the search bar.

I have tried using the URL

e621.net/tags.json?search=horse male -female

as is placed on the tags section of the API documentation.
I have also tried

e621.net/tags.json?search[horse male -female]

,

e621.net/posts.json/tags=search[male -female horse]

. none of these have given me what I want.

They either do not give me anything or aren't consistent with what I see when I type those tags into the search bar.

What should I be typing, and what syntax should I use in the future?

applephrans said:
Try this

https://e621.net/posts.json?tags=horse+male+-female&limit=15

https://e621.net/posts.json is for anything related to posts

tags=horse+male+-female is the query parameter for the search for horse male -female. Use + as spaces

limit=15 is the query parameter that limits it to 15 posts

The ? is used to indicate the start of the query parameters section of the URL and the & is used to separate multiple query parameters from each other

Thank you, this will help me a lot.

  • 1