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 trialYounes RAFIE
Courses Plus Student 2,055 PointsTreehouse users API
Hi, when visiting a user profile we see the number of points earned on that topic, but what's the max points that can be earned on that topic ( to get a percentage)?
Thanks
3 Answers
Riley Hilliard
Courses Plus Student 17,771 Pointsif you are using the API, as in returning json, you can grab this fairly easily. Here's a sample return from your profile, accessible at teamtreehouse.com/younesrafie.json:
{
"name": "Younes RAFIE",
"profile_name": "younesrafie",
"profile_url": "http://teamtreehouse.com/younesrafie",
"gravatar_url": "https://secure.gravatar.com/avatar/862d65cadc47ead67218bcd6a148f03d?s=200&d=https://teamtreehouse.com/assets/content/default_avatar.png&r=pg",
"gravatar_hash": "862d65cadc47ead67218bcd6a148f03d",
"badges": [
{
"id": 49,
"name": "Newbie",
"url": "http://teamtreehouse.com/younesrafie",
"icon_url": "https://wac.A8B5.edgecastcdn.net/80A8B5/achievement-images/Generic_Newbie.png",
"earned_date": "2013-12-29T20:35:41Z",
"courses": []
},
{
"id": 48,
"name": "Elements",
"url": "http://teamtreehouse.com/library/aesthetic-foundations/elements",
"icon_url": "https://wac.A8B5.edgecastcdn.net/80A8B5/achievement-images/Aesthetic_Elements.png",
"earned_date": "2013-12-29T20:58:59Z",
"courses": [
{
"title": "Websites",
"url": "http://teamtreehouse.com/library/websites",
"badge_count": 1
},
{
"title": "Aesthetic Foundations",
"url": "http://teamtreehouse.com/library/aesthetic-foundations",
"badge_count": 1
},
{
"title": "Elements",
"url": "http://teamtreehouse.com/library/aesthetic-foundations/elements",
"badge_count": 1
}
]
},
{
"id": 386,
"name": "Starting a Freelance Career",
"url": "http://teamtreehouse.com/library/how-to-freelance/starting-a-freelance-career",
"icon_url": "https://wac.A8B5.edgecastcdn.net/80A8B5/achievement-images/badges_HowToFreelance_Stage1.png",
"earned_date": "2014-01-06T20:12:39Z",
"courses": [
{
"title": "Business",
"url": "http://teamtreehouse.com/library/business",
"badge_count": 1
},
{
"title": "How to Freelance ",
"url": "http://teamtreehouse.com/library/how-to-freelance",
"badge_count": 1
},
{
"title": "Starting a Freelance Career",
"url": "http://teamtreehouse.com/library/how-to-freelance/starting-a-freelance-career",
"badge_count": 1
}
]
},
{
"id": 387,
"name": "Finding Your First Project",
"url": "http://teamtreehouse.com/library/how-to-freelance/finding-your-first-project",
"icon_url": "https://wac.A8B5.edgecastcdn.net/80A8B5/achievement-images/badges_HowToFreelance_Stage2.png",
"earned_date": "2014-01-06T22:58:22Z",
"courses": [
{
"title": "Business",
"url": "http://teamtreehouse.com/library/business",
"badge_count": 1
},
{
"title": "How to Freelance ",
"url": "http://teamtreehouse.com/library/how-to-freelance",
"badge_count": 1
},
{
"title": "Finding Your First Project",
"url": "http://teamtreehouse.com/library/how-to-freelance/finding-your-first-project",
"badge_count": 1
}
]
},
{
"id": 388,
"name": "Pricing and Project Proposals",
"url": "http://teamtreehouse.com/library/how-to-freelance/pricing-and-project-proposals",
"icon_url": "https://wac.A8B5.edgecastcdn.net/80A8B5/achievement-images/badges_HowToFreelance_Stage3.png",
"earned_date": "2014-01-07T14:56:59Z",
"courses": [
{
"title": "Business",
"url": "http://teamtreehouse.com/library/business",
"badge_count": 1
},
{
"title": "How to Freelance ",
"url": "http://teamtreehouse.com/library/how-to-freelance",
"badge_count": 1
},
{
"title": "Pricing and Project Proposals",
"url": "http://teamtreehouse.com/library/how-to-freelance/pricing-and-project-proposals",
"badge_count": 1
}
]
}
],
"points": {
"total": 217,
"html": 0,
"css": 0,
"javascript": 0,
"ruby": 0,
"ios": 0,
"business": 120,
"android": 0,
"php": 25,
"wordpress": 0,
"design": 36,
"dev tools": 0
}
}
As you can see at the very bottom, there is an object called "points", which has a breakdown of all your points by category as well as you total points. Let's assume you made an AJAX call which returned this object: in JavaScript you would access the "total" number by:
console.log(data.points.total);
If you would like to see a sample AJAX call, let me know and I'll write one out for you. If you would like to see some example code of a project I did using the treehouse user data, checkout reportcard.js. It reads your profile information and outputs a treehouse badge report card for use on a portfolio or resume website.
James Barnett
39,199 Points>
what's the max points that can be earned on that topic
That information isn't currently exposed via the Treehouse API. You can email help@teamtreehouse.com to request that feature be added.
Riley Hilliard
Courses Plus Student 17,771 PointsAhhhh, just realized I read the questions wrong, doh! James is right, you cannot tell the max points of a topic from the treehouse API at the moment.
Younes RAFIE
Courses Plus Student 2,055 Pointscan you please explain me how Treehouse build the points chart on users profiles, because we earn points on answering questions on forum for example but we don't see that on chart?
Caesar Bell
24,829 PointsAre there params I can add to the https://teamtreehouse.com/caesarbell.json endpoint example https://teamtreehouse.com/caesarbell.json?javascript=true to just get back anything related to javascript ?