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
Alcibiades Montas
5,974 PointsHow to use the facebook API to calculate an individual's number of messages/wall posts/etc?
Hi I am trying to build an app that uses the facebook API, to quantify an individual's usage of facebook (how many wall posts, messages, pics, etc). I am starting to read the SDK but feel lost as it doesn't seem like it uses JSON for its objects.
Anybody familiar on whether I could query these sort of objects and then bring them on to my app? Any tutorials would be helpful?
1 Answer
Austin Knight
2,251 PointsYou can find the calls here under the JavaScriptSDK tab https://developers.facebook.com/docs/graph-api/reference/v2.0/user/feed
In order to use the javascript SDK for those types of queries, you have to make sure you have valid login first with the right permissions accepted by the user.
I'm not sure how much access you get to everything with the JS SDK though, but you can definitely pull posts and count them.
I would also take a look at the reference for all the JS SDK API endpoints. https://developers.facebook.com/docs/graph-api/reference/v2.0
Your calls will looks something like:
/* make the API call */
FB.api(
"/me/feed",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
Hope that helps a little