Search code examples
pythonjsonapiimgur

Correct API call to request JSON-formatted data from Imgur?


I am having a bit of trouble understanding API calls and the URLs I'm supposed to use for grabbing data from Imgur. I'm using the following URL to grab JSON data, but I'm receiving old data: http://imgur.com/r/wallpapers/top/day.json

But if I strip the .json from the end of the URL, I see the top pictures from today.

All I want is the JSON data from the top posts of today from Imgur, but keep getting data the refers to Dec 18th, 2014.

I'm using the call in a Python script. I have a token from Imgur to do the stuff, and reading the API documentation, I see a lot of the examples start with https://api. instead of http://imgur.

Which one should I use?


Solution

  • Imgur updated their docs, so the new and correct form of the URL I used was:

    r = requests.get("https://api.imgur.com/3/gallery/r/earthporn/top/")