criso / fbgraph

NodeJs module to access the facebook graph api
http://criso.github.io/fbgraph/
1.09k stars 176 forks source link

graph.setVersion doesn't seem to be working #99

Closed jonkeegan closed 8 years ago

jonkeegan commented 8 years ago

Hey there. Seeing a weird issue which looks to me like graph.setVersion isn't working. I'm pulling posts from a public Facebook page (using an app token). Using the Graph API explorer, if I set my request to use v2.5 or v2.4, I will only get back the message, created_time and id fields in my response. But if I change the explorer to earlier versions (v2.0 - v. 2.3) I get back many more fields (picture, source, link, name, caption, etc.). So I'm trying to use setVersion to use the earlier version as I want the more verbose response.

So using fbgraph, I have:

 graph.setVersion("2.1");
 graph.setAccessToken(the_token);
 graph.get("/8304333127/posts?limit=100", function(err, res) {
console.log(JSON.stringify(res));
});

The response using 2.1:

{
    "data": [{
        "message": "Tesla CEO Elon Musk took the stage in front of a hooting crowd of fans and clients to reveal the Model 3.",
        "created_time": "2016-04-01T14:20:00+0000",
        "id": "8304333127_10154185641613128"
    }, {
        "message": "Today's jobs report likely wasn’t strong enough to provoke Fed action at its next policy meeting this month, Jon Hilsenrath writes.",
        "created_time": "2016-04-01T14:00:00+0000",
        "id": "8304333127_10154185639173128"
    }, {
        "message": "The office of Luxembourg’s state prosecutor is investigating whether hundreds of millions of dollars sent to an account at a bank in Luxembourg originated from 1MDB.",
        "created_time": "2016-04-01T13:40:00+0000",
        "id": "8304333127_10154185633468128"
    }, 

So it seems to be using a more recent version of the API here, at least 2.4 or 2.5.

Any thoughts?

jonkeegan commented 8 years ago

Ah my bad. They require you send the fields that you want if you want more than those three. Sorry!

more info: http://stackoverflow.com/questions/32584850/facebook-js-sdks-fb-api-me-method-doesnt-return-the-fields-i-expect-in-gra