Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Roberto Rivera
Roberto Rivera
11,361 Points

Imgur API issues

Hello All,

I was trying to exercise my AJAX learning and attempted to work with the imgur API. Essentially my long term goal is to create a simple web page that will allow users to search through imgur for wallpaper using specific criteria.

The short term goal for making this work though was simply post pictures from the gallery as sort of proof of concept. Now, I've run into an issue, one of which I feel may have a simple answer but I've sort of bashed my fists against it not quite sure how to solve it.

The problem is that I've succeeded in grabbing the links from the api to get pictures, However the JSON is structured in a way where it will also give me the link for an album rather than the pictures which comprise the album. As a result I have a page that includes some pictures and a whole bunch of 'broken links' as the album can be displayed as a picture by it's very nature.

I'm reaching out to imgur's staff about this as well, but I thought that I've had great luck with the treehouse community. I'm including a snapshot of my work thus far as well as a sample of some of the raw JSON data. In addition, I'm including a sample of the console.log of the concatenated variable that posts to the HTML to create the images. So you see the results of what happens when it runs.


Thank you for any help you can provide.

1 Answer

Steven Sullivan
Steven Sullivan
11,616 Points

Hi Roberto,

Try changing the link you're pulling to something like 'https://api.imgur.com/3/album/{albumid}/images'