Users.getStandardInfo

From Facebook Developer Wiki

Jump to: navigation, search

Contents

Description

Returns an array of user-specific information for use by the application itself. Make this call on behalf of your application when you need analytic information only. Don't display this information to any users. If you need to display information to other users, call users.getInfo.

The information you can get from this call is limited to:

  • uid
  • first_name
  • last_name
  • name
  • timezone
  • birthday
  • sex
  • affiliations (regional type only)
  • locale
  • profile_url
  • proxied_email

The only storable values returned from this call are the user IDs.

This call returns nothing for any users who haven't authorized your application to access their information.

This method may not be used by Desktop applications or in the context of a session secret-based session.

Parameters

RequiredNameTypeDescription
required api_key string The application key associated with the calling application.
call_id float The request's sequence number. Each successive call for any session must use a sequence number greater than the last. We suggest using the current time in milliseconds, such as PHP's microtime(true) function.
sig string An MD5 hash of the current request and your secret key, as described in the How Facebook Authenticates Your Application.
v string This must be set to 1.0 to use this version of the API.
uids array List of user IDs. This is a comma-separated list of user IDs.
fields array List of desired fields in return. This is a comma-separated list of field strings and is limited to these entries only: uid, first_name, last_name, name, timezone, birthday, sex, affiliations (regional type only), locale, profile_url, proxied_email.
optional format string The desired response format, which can be either XML or JSON. (Default value is XML.)

Example Requests

Using the PHP Library

$user_details=$facebook->api_client->users_getStandardInfo($uid, array('last_name','first_name')); $data['first_name']=$user_details[0]['first_name']; $data['last_name']=$user_details[0]['last_name'];

Response

The user info elements returned are those friends visible to the Facebook Platform. If no visible users are found from the passed uids argument, the method returns an empty result element. Following is a list of arguments and the elements they return:

  • uid - The user ID corresponding to the user info returned. This is always returned, whether included in fields or not, and always as the first subelement.
  • affiliations - The list of network affiliations, as affiliation elements, each of which contain year, type, status, name, and nid child elements. If no affiliations are returned, this element will be blank. The user's primary network (key: nid) will be listed first.
    • type - Can take the region value only, which represents the user's geographical network.
  • birthday - User-entered "Birthday" profile field. No guaranteed formatting.
  • first_name - Generated from the user-entered "Name" profile field.
  • last_name - Generated from the user-entered "Name" profile field.
  • name - User-entered "Name" profile field. May not be blank.
  • sex - User-entered "Sex" profile file. Either "male", "female", or left blank.
  • timezone - The time offset relative to GMT (e.g., California is -8).
  • proxied_email - The proxied wrapper for a user's email address. This is for Facebook Connect only.

Privacy note: The visibility of the birthday and sex fields may be restricted by the user's Facebook privacy settings in relation to the calling user (the user associated with the current session).

A user profile query will not return any data if the user has turned off access to Facebook Platform.

Example Return XML

<?xml version="1.0" encoding="UTF-8"?> <users_getInfo_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd" list="true"> <user> <uid>8055</uid> <affiliations list="true"> <affiliation> <nid>50453093</nid> <name>Facebook Developers</name> <type>work</type> <status/> <year/> </affiliation> </affiliations> <first_name>Dave</first_name> <last_name>Fetterman</last_name> <name>Dave Fetterman</name> <timezone>-8</timezone> </user> </users_getInfo_response>


FQL Equivalent

FQL queries take the form: SELECT <fields> FROM <table> WHERE <conditions>

This function is similar to doing the following FQL query, with the appropriate parameters specified (note you can SELECT any fields from the list described above):

SELECT uid, birthday FROM standard_user_info WHERE uid IN (uids)

Error Codes

CodeDescription
1 An unknown error occurred. Please resubmit the request.
2 The service is not available at this time.
4 The application has reached the maximum number of requests allowed. More requests are allowed once the time window has completed.
5 The request came from a remote address not allowed by this application.
100 One of the parameters specified was missing or invalid.
101 The API key submitted is not associated with any known application.
103 The submitted call_id was not greater than the previous call_id for this session.
104 Incorrect signature.
608 Invalid application type; desktop applications may not call this method.
609 Session secrets not allowed. This method may not be called with a session secret.
reference