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 Node.js Basics (2014) Building a Command Line Application Making a GET Request with http

Meeyoung Kim
Meeyoung Kim
8,763 Points

406 error occured with https

Hi there~ I'm also getting 406 error for status code though "Allow everyone to see your profile" is CHECKED and "https" is used. Would you let me know what I should do?

Lean Rasmussen
Lean Rasmussen
11,060 Points

I was succesfull today in completing this challange using the follwoing code :

//problem : we need a simple way to look at a users badge count and JS points:

// use node js to connect to treehouse api to get profile information to print out. var https = require("https"); var username = 'leanrasmussen';

function printMessage(username, badgeCount, points){ var message = username + ' has ' + badgeCount + ' total badge(s) and ' + points + ' many points. WOW that is really amazing.' console.log(message); }

//connect to the APi url https://teamtreehouse.com/leanrasmussen.json

var request = https.get('https://teamtreehouse.com/' + username + '.json', function(responese){ console.dir(responese)

}); //read the data //parse the data //print the data out.