Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook graph API get all fields data

From my understanding, we can retrieve user information via something like this:

$cordovaFacebook.api(
    "me?fields=name,email,picture", ["public_profile", "email"])
    .then(function (response) {
           console.log(response);
    }, error);

How can we directly get all available information without listing out one by one?

like image 608
user1995781 Avatar asked Sep 19 '15 06:09

user1995781


1 Answers

How can we directly get all available information without listing out one by one?

You can’t.

With API v2.4, Facebook has reduced the number of fields returned by default for the various endpoints, to improve performance (especially with regard to mobile connections.)

That was a deliberate decision – and to allow for a “way around” it, would just make a lot of lazy-a** developers still just request them all ;-)


Perhaps you have heard at some point, that in SQL f.e. a SELECT * is considered bad practice as well – this is pretty much the same case here. You are supposed to explicitly ask for the data you need now – and not just go “I’ll request it all, and figure out what I could possible use it for later.”


If you are not sure what fields are available for a certain endpoint – then either consult the documentation for that endpoint, or use Introspection to get a list of all fields.

like image 85
CBroe Avatar answered Oct 19 '22 13:10

CBroe