Topic: Api Request returns 404 in script but not in browser

Posted under e621 Tools and Applications

Exactly as the title says. I'm trying to get any response from the api but it 404's when executed through a script

Updated

fisk24 said:
Exactly as the title says. I'm trying to get any response from the api but it 404's when executed through a script

What type script do yo use? If you wan't download file then use User-Agent like in this post

curl -A "e621-downloader/1.6 (Yusifx1/e621-scripts)"  "https://e621.net/posts.json?tags=furry&login="Your login"&api_key="Your apikey" 


You add login and api_key and separate it from others with "&" like in changing page.
Sorry my english. If you don't understood i will translate with google.

tysh1 said:
What type script do yo use? If you wan't download file then use User-Agent like in this post

curl -A "e621-downloader/1.6 (Yusifx1/e621-scripts)"  "https://e621.net/posts.json?tags=furry&login="Your login"&api_key="Your apikey" 


You add login and api_key and separate it from others with "&" like in changing page.
Sorry my english. If you don't understood i will translate with google.

Im actually using volly, its an android library for making requests. I believe i have set my user agent already.
I would expect to get a 403 and not a 404 if the User-Agent was wrong.

Omg. I'm so stupid.
From the wiki

HTTP defines four request methods: GET, POST, PATCH and DELETE. You'll be using these four methods to interact with the e621 API. Most API calls that create a new database entry use POST, calls that update an existing entry use PATCH and calls that only retrieve data use GET.

And I missed this very important part

and calls that only retrieve data use GET.

On the old API i could get away with using POST for this. I switched it to GET and now it works.
Let this be a lesson. Always read sentences to the end.

On the bright side, in trying to fix this bug, I did FINALLY implement a proper User-Agent :P

  • 1