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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Nadine Schermerhorn](https://secure.gravatar.com/avatar/fa3eac1af20a6df3a98e69f5a7a6c246?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Nadine Schermerhorn
2,324 PointsHaving trouble with the "Getting the Response Body" video. My workspace doesn't come return the body.
My workspace isn't responding the same as the video. It doesn't appear to be going through the response.on function section since I can't console.log anything out of it. Help//Problem: We need a simple way to look at a user's badge count and JavaScript points
//Solution: Use Node.js to connect to Treehouse's API to get profile information to print out
var username = "chalkers";
var http = require("http");
function printMessage(username, badgeCount, points) {
var message = username + "has " + badgeCount + " total badge(s) and " + points + " points in JavaScript";
console.log(message);
}
//printMessage("Chalkers", 1000, 2000);
//Connect to the API URS (https://teamtreehouse.com/username.json)
var request = http.get("http://teamtreehouse.com/" + username + ".json", function(response) {
console.log(response.statusCode);
response.on('data', function(chunk) { //Read the data
console.log('BODY: ' + chunk);
});
//Parse the data (bring the data from a string into program friendly way of interacting with it)
//Print the data
});
request.on("error", function(error) { //using on method to listen for an error event
console.error(error.message);
});
1 Answer
![Joel Kraft](https://secure.gravatar.com/avatar/f16e6d344f5249606645ff7c1e62af86?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Joel Kraft
Treehouse Guest TeacherHi Nadine,
This is probably an issue with the api, which is now served over https instead of http. See the accepted answer to this post, and let us know if that solves it for you.