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 trial

JavaScript

github api

I've been looking over the github API for a few days looking at repos and pages. Trying to figure things out. I also came across this on the treehouse blog but couldn't quiet get the desired result.

a simple few lines of javascript returns my repos as JSON

var github = {
    load : function(username) {
        $.ajax({
            method: 'GET',
            url: 'https://api.github.com/users/' + username + '/repos',
            dataType: 'json',
            success: function(response) {
                console.log(response);
            },
            error: function() {}
        });
    }
}

Where my username is being passed in as the username for the load function.

The response object has a ton of great data, it does have a boolean "has_pages" which returns a true or false value on whether or not this repos has a github pages page over at github.io. It doesn't however give me the url for the github pages page.

In the github API they do have a pages section under the repos section of their documentation. I cannot make heads or tails of it though and get a response.

The goal of this is to grab a list of my repositories that have a page associated with them, (and some sort of tag as well like "portfolio-piece") and then take all repos that meet that criteria and build my portfolio on my page with that information.