I am creating a web application that displays the status of authenticated users. Anyway, can I do this using the Facebook graphical API ? The only thing I find is FQLthat I cannot use, because I am not allowed to use php.
Edit: Also, I don't need many statuses. I need only my last friends.
Edit: fbID is the facebook id. Here is my code:
<script>
var self;
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
window.fbAsyncInit = function() {
FB.init({
appId : '190843834372497',
channelUrl : 'http://people.rit.edu/~cds7226/536/project3/channel.html',
status : true,
cookie : true,
xfbml : true
});
FB.Event.subscribe('auth.statusChange', function(response) {
if (response.authResponse) {
FB.api('/me', function(me){
if (me.name) {
document.getElementById('auth-displayname').innerHTML = me.name;
self=me;
}
})
document.getElementById('auth-loggedout').style.display = 'none';
document.getElementById('auth-loggedin').style.display = 'block';
} else {
document.getElementById('auth-loggedout').style.display = 'block';
document.getElementById('auth-loggedin').style.display = 'none';
}
});
document.getElementById('auth-loginlink').addEventListener('click', function(){
FB.login(function(response){},{scope: 'friends_status,read_stream'});
});
}
</script>
Then this function is executed when you press the button. He receives the user's last request in the location and personal information, including their facebook ID.
function getFriendsCheckin(token)
{
$.getJSON('https://api.foursquare.com/v2/checkins/recent?oauth_token='+token+'&v='+"20120514",function(results){
$.each(results['response']['recent'], function(key,value){
var fullName = value['user']['firstName']+" "+value['user']['lastName'];
var timeStamp = value['createdAt'];
var photo = value['user']['photo'];
var fbID = value['user']['contact']['facebook'];
var locName = value['venue']['name'];
var location = new google.maps.LatLng(value['venue']['location']['lat'],value['venue']['location']['lng']);
setCustomMarker(location,fullName+'@'+locName,fbID,photo);
});
})
}
, . friendd, Google.
function setCustomMarker(location,title,fbID,icon)
{
var marker = new google.maps.Marker({
position: location,
draggable: false,
map: map,
title: title,
});
google.maps.event.addListener(marker,'click',function(){
console.log('SELECT status_id,message FROM status WHERE uid='+fbID);
FB.api(
{
method: 'fql.query',
query: 'SELECT status_id,message FROM status WHERE uid='+fbID
},
function(response){
console.log(response);
}
);
});
}