From what I understand of your question, you need to make use of the Facebook API to collect data and / or the feed of a given user by receiving them in the form of an object.
If you make a HTTP Get
to the address graph.facebook.com
with parameters appropriate to what you want and a valid access Token, you will get back a JSON object with the desired information.
There are three types of data that fall into what is called feed , which leads you to use the appropriate link for what you want to collect, so you can HTTP Get
and collect the information:
-
Status updates status updates
http://graph.facebook.com/IdUtilizador/statuses?access_token=TokenDeAcessoValido
-
List of items on the user wall wall stream
http://graph.facebook.com/IdUtilizador/wall?access_token=TokenDeAcessoValido
-
List of items in the user home home feed
http://graph.facebook.com/IdUtilizador/home?access_token=TokenDeAcessoValido
The Facebook documentation for this subject may be found .
The information received is a JSON that is an object thus giving account of your problem.
Example in JSFiddle
Below is an example of the data format we received:
{
"id": "220439",
"name": "Bret Taylor",
"first_name": "Bret",
"last_name": "Taylor",
"link": "http://www.facebook.com/btaylor",
"gender": "male",
"locale": "en_US",
"username": "btaylor"
}
The usage is relatively simple:
var endereco = "http://graph.facebook.com/btaylor";
$.getJSON(endereco, function(data) {
var name = data["name"];
$("#meuElemento").append("<h3>"+name+"</h3>");
});
There are also other examples of information that can be collected in the form of objects. On this page (English) , among many are the ones I mentioned above .
Using the Facebook query language, you can perform the same SQL queries and collect the data in a more practical and non-junk way:
On the Overview (English) page, they have a series of examples, but we'll collect the name as illustrated above:
var endereco = "http://graph.facebook.com/";
var consulta = "fql?q=SELECT name FROM user WHERE uid = me()";
var tokenAcesso = "&access_token=XXXX";
$.getJSON(endereco+consulta+tokenAcesso, function(data) {
var name = data["name"];
$("#meuElemento").append("<h3>"+name+"</h3>");
});
Queries can be tested in Graph Explorer (English) .