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! While you're at it, check out some resources Treehouse students have shared here.
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 trialLadna Meke
5,752 PointsGithub API: How to use Image thumbnails for repos
Hello, I am making a simple JSON call to github repos api to display user repos, and providing them in a list; basic stuff.
However,I want to have a clickable image placeholder that redirects to the project homepage. Problem is, I couldn't find any property in the returned JSON that can enable me reference an image for a particular project.
Just out of curiosity, can I set thumbnails on my own github projects? Maybe having an image in any project, and hoping I can access the image URL from the returned JSON.
If any of the above can be done in either of jQuery/Angular, I would appreciate even more.
Thanks
3 Answers
Kevin Lozandier
Courses Plus Student 53,747 PointsHi,
Github does in fact allow you to tap into an API to do what you're describing to an extent; the attributes that can be retrieved can be found here.
Setting thumbnails for a particular project doesn't seem to be available; from my experience with the API, I don't recall Github allowing you to associate a particular image to a specific repo. That said, I may be wrong.
Anyhow, like any properly thought-out API for a popular site, do note there's usage restrictions for how long and how much requests can be made from their API per day.
Ladna Meke
5,752 PointsThanks Kevin, it's not a development project. It's just one for the books; so I'm pretty sure I'm not gonna pass the API call limit
Kevin Lozandier
Courses Plus Student 53,747 PointsHi, Ladna:
Didn't realize you meant Gitbook.io.
I haven't seen much documentation of Gitbook's API; however I did come across a NodeJS package from the Gitbook.io's github account that seemingly would allow you to get a hold of some of the data you're looking for: https://github.com/GitbookIO/api-client