Talk:Users.getInfo

From Facebook Developer Wiki

Jump to: navigation, search

For education_history, there are only 4 fields - year, name, concentrations and degree. Facebook also keeps track (requests from the user and displays on their profile) of whether each school is graduate or undergraduate. Any reason why that information can't be accessed through the API?

It is accessible through the API. Check the call in the API test console. I return my education history when I call it. Pete (563683308 00:11, 2 September 2009 (PDT))

Can i get a history of relationship from a user / friends ?

You mean like a timeline for when two users became friends? No, because you'd likely violate the policy against storing data like friend IDs or the relationship between two user IDs. See Storable Data for more information. Pete (563683308 13:44, 22 July 2009 (PDT))

Can this users.getInfo be used on my own site with facebook connect? How is it implemented? i.e. where do I run the php?

Yes, you can use this method (and most other API calls -- see How Connect Interacts with the Facebook API for exceptions) with Facebook Connect. Call the Facebook REST server -- http://api.facebook.com/restserver.php -- directly, or install the PHP client library locally and call it through the client (or any other client if you prefer). -- Pete (563683308 12:43, 18 June 2009 (PDT))

Is there any ordering guarantee on the results?

The info fields are returned in the order in which they're specified in the call, so:
$facebook->api_client->users_getInfo('uid1, uid2','birthday, locale, name');
Would return the birthday, locale and name in that order. -- Pete (563683308 00:39, 6 January 2009 (PST))

--

Is there any way to access the users phone or mobile phone number?

[Mike@FB] No.

--

Is there an option to select ALL fields? If I know I'm going to fetch some majority of fields it would be much more convenient to run users_getInfo($uid, array('all')) instead of listing out 37+ fields to fetch.

[Mike@FB] No. This is actually to make the average case more efficient, i.e., with SQL there's often a tendency to be a lazy and do a SELECT * when you only need a handful of fields. To prevent folks from unnecessarily doing SELECT *, we require folks to explicitly specify the needed fields.

--

education_history.degree is not included in this documentation. I would add it if I knew anything about it.

[Mike@FB] Added. It's a simple string.

--

How do i get the getInfo function to reply me an XML? and how can i see that is an XML what i get?

[Mike@FB] The format parameter can be configured to return either XML or JSON.

--

The current_location.state field does not return a two letter abbreviation - when I set up the user's location to San Diego, CA then the current_location.state returns "California". Let's keep the documentation consistent...

Yeah I noticed that the state is not an abbreviation also, is there any way to get an abbreviation? This would be very helpful.

[Mike@FB] We'll consider that for the future. We can't change the current value because it would be unnecessarily disruptive to existing apps.

--

Is there any way to access the users phone or mobile phone number?

[Mike@FB] No, that information is not exposed via the API.

--

Might be a bit slow, but what is "$this"? Edit: After playing around, I came up with this working example:

$user_details=$facebook->api_client->users_getInfo($row['fbid'], array('last_name','first_name'));

$data['first_name']=$user_details[0]['first_name'];

$data['last_name']=$user_details[0]['last_name'];

(note: No $this whatever - way tired :D)

--

It appears this is currently undocumented, but current_location returns 'zip' in addition to the listed fields, at least in some circumstances 776158039 16:00, 6 November 2008 (PST)

Yeah, it was removed due to a miscommunication. hometown_location does not return zip, so I straightened this out. Thanks for noticing! -- Pete 563683308 07:23, 7 November 2008 (PST)

--

[skypesync] I'm another developer who would appreciate possibility to get access to phone numbers via API It will open a bunch of sync possibilities that can be useful for users.

--

How can I get a count of the user's facebook friends?

Call friends.get and count the results that get returned. Pete (563683308 20:08, 17 August 2009 (PDT))
I am trying: public void FacebookTest()
           {
               facebook.Components.FacebookService _fbService = new facebook.Components.FacebookService();
               _fbService.ApplicationKey = apikey;
               _fbService.Secret = apisecret;
               IList<long> frnds = _fbService.friends.get();
               int numberOfContacts = frnds.Count;
               Console.WriteLine("##########Number of contacts are: " + numberOfContacts.ToString());
           }

But it gives me the error: An unhandled exception of type 'facebook.Utility.FacebookException' occurred in facebook.dll

Contents

[edit] Session_key Optional?

I am hitting the restserver directly via my rails app. I send the correct details to it, for a users.getInfo request (including a session_key) and I get an expected result. If I remove the session_key, it no longer gives me the name. Just a nil in its place.

This a bug?

Perhaps. I trust you're using the same UID in both cases, and that the user's privacy settings aren't set to hide the name (as in, the user doesn't have a public profile listing). If you're able to see the user's name when you pass a session key, but get null when you don't pass a session key with the same UID, then it could be a bug. If so, please file a bug, and include the repro steps and the relevant code snippet. Thanks! -- Pete (563683308 22:43, 5 April 2009 (PDT))
The session key is not really optional. If you don't supply it then this function behaves just like if the user has not authorized your application. If you leave out the session key then it does not matter if the user has authorized your application or not, you can only get publicly viewable information if the user has selected to "create a public search listing". The wiki really needs to be updated with clear details about what happens when you leave out the session key. -- Anonymous

[edit] Fields subject to privacy settings

I don't see it documented, but at least in my tests, if the user doesn't check "Show my sex in my profile", which is unchecked by default, the "sex" field returns empty. I assume that the same thing is true for "birthday" if the user selects "Don't show my birthday in my profile", but at least in the "birthday" case it's not selected by default. I tried using getStandardInfo, a FQL query, and this behavior is consistent.

Is there an alternative way to get this info (specifically "sex") even with requiring extended permissions?

--

The wiki entry states that "In addition, the visibility of all fields, with the exception of affiliations, first_name, last_name, name, and uid may be restricted by the user's Facebook privacy settings in relation to the calling user (the user associated with the current session)." But from what I have seen, the name fields are also subject to the privacy settings. Is this a documentation error?

[edit] Bug with Facebook Connect

Is there a reason that when a users privacy settings don't allow for other users to see their first name or last name $details = $facebook->api_client->users_getInfo($_POST['uid'], array('last_name','first_name', 'pic_square')); would no longer return "Facebook User"?

I haven't found any documentation on this, and it seems like it worked two weeks. Right now it will return empty variables on some of my calls.

If you're finding that this behavior persists, please file a bug; include your Connect URL so we can investigate. Thanks, Pete (563683308 11:30, 1 May 2009 (PDT))

Can you get all of this information even if you are not a "friend" with the person?

You mean can your application get all the data that can possibly be returned with this call? That depends. As per the docs, if the user hasn't authorized your application, then you can get publicly viewable data like the name, profile pic, etc. If the user authorizes your application, you'll get a session for the user -- passing that session key allows you to get more data about a user. And user privacy trumps this -- if the user has opted out of Platform or chooses to not have any data publicly viewable, then you won't get anything from the call. Pete (563683308 16:17, 22 July 2009 (PDT))

[edit] Is it allowed to generate statistics on the fly based on personal (not storable) data of the users?

for example: the count of islamic, christian protestants visitor of my site; the count of visitor with a degree.... and store that data?

Please submit your question to the Developer Help Form. Thanks, Pete (563683308 11:07, 27 August 2009 (PDT))

[edit] Full size profile picture

The 'pic_big' is actually not so big. It's scaled down to 200px width.

Is there a way to get the full-size profile picture?

Also, sometimes pic_big is empty, even though the user has a profile picture. Any idea why? ^----i would love to know the answer to this

[edit] How can I get the email domain of the user?

In my application, I want to allow users with email ids of specific domains only. Giving the email domain of the user will not be a privacy scary thing. So why don't you give it ?

== Multiple Sessions? Is it possible to pass multiple session_keys along with multiple uids in order to have a single hit to Facebook rather than multiple?

No, but you could batch a number of calls and call batch.run. Pete (563683308 10:28, 25 September 2009 (PDT))

[edit] How can i Get College Info

How can i get info about (Attended for College) i have used hs_info but it returns only year see my code

$user_details=$facebook->api_client->users_getInfo($uid, array('hs_info','education_history')); echo "hs1_name=".$user_details[0]['hs_info']['hs1_name']; echo "hs2_name=".$user_details[0]['hs_info']['hs2_name']; echo "hs1_id=".$user_details[0]['hs_info']['hs1_id']; echo "hs2_id=".$user_details[0]['hs_info']['hs2_id'];

but all these fields are blank. how can i get info of Attended for college/school info which we enter in our profile

reference