Search code examples
jsonapiimgur

Easiest way to get imgur content type from imgur API


Link examples:

Currently I'm just doing https://api.imgur.com/3/gallery/[ID].json for all links and get wether is_album is true or not. This works for the 1. image link and the album link above, but it returns 404 for the 2. image link (no idea why).
If it's returns 404, i'm doing an image api request (https://api.imgur.com/3/image/OBEF9yi.json) for that failed image.

I want to know if there's a easier (with one api call) way to determine which link is which content type (either album or image).


Solution

  • I actually found a bug in the imgur api. It shouldn't be possible to get a short URL like this for URLs. Reported to imgur & they have recognized it.

    As soon as they've fixed it, it is possible to do an image api call (https://api.imgur.com/3/image/[ID].json) and get wheter animated is true or not.