Pages.getInfo

From Facebook Developer Wiki

Jump to: navigation, search

Contents

Description

Returns all visible Facebook Pages to the filters specified. This may be used to find all Pages of which a user is a fan, or to query specific Page IDs. The session_key parameter is optional. When the session_key parameter is not passed, you can get information only for Pages that have added your application. The uid parameter is not even considered. With a session key, normal privacy rules are put into place.

Parameters

RequiredNameTypeDescription
required api_key string The application key associated with the calling application. If you specify the API key in your client, you don't need to pass it with every call.
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. If you specify the call ID in your client, you don't need to pass it with every call.
v string This must be set to 1.0 to use this version of the API. If you specify the version in your client, you don't need to pass it with every call.
fields string List of desired fields to return. This is a comma-separated list of field strings and is described below.
optional session_key string The session key of the logged in user. The session key is automatically included by our PHP client.
format string The desired response format, which can be either XML or JSON. (Default value is XML.)
callback string Wrap the response inside a function call. This is primarily to enable cross-domain javascript requests using the <script> tag, sometimes known as "JSONP". This works with both XML and JSON.
page_ids string List of page IDs. This is a comma-separated list of page IDs.
uid int The ID of the user. Defaults to the logged in user if the session_key is valid, and no page_ids are passed. Used to get the pages a given user is a fan of.
required sig string An MD5 hash of the current request and your secret key, as described in the How Facebook Authenticates Your Application. Facebook computes the signature for you automatically.

Response

The Page info elements returned are those visible to Facebook Platform. Following is a list of arguments and the elements they return:

  • page_id - The ID corresponding to the page returned. This is always returned (whether included in fields or not, and always as the first subelement.
  • name - Page entered profile field. May not be blank.
  • page_url - Page URL. May not be blank.
  • pic_small - URL of profile picture, with max width 50px and max height 150px. May be blank.
  • pic_square URL of a square section of the profile picture, with width 50px and height 50px. May be blank.
  • pic_big - URL of profile picture with max width 200px and max height 600px. May be blank.
  • pic - URL of profile picture with max width 100px and max height 300px. May be blank.
  • pic_large - URL of profile picture with max width 396px and max height 1188px. May be blank.
  • type - Contains the type of the page.
  • website - Contains the website of the page.
  • location - Contains the location of the entity. Applies to Local Businesses. Contains five children: street, city, state, country, zip . Notes on each othe children: street may be blank; city may be blank; state is a well-defined two-letter American state or Canadian province abbreviation, and may be blank; country is well-defined, and may be blank; zip is an integer, and is 0 if unspecified.
  • hours - Contains the operating hours. Each local business will be allowed to specify up to two sets of operating hours per day. Contains the following children, mon_1_open, mon_1_close, tue_1_open, tue_1_close, wed_1_open, wed_1_close, thu_1_open, thu_1_close, fri_1_open, fri_1_close, sat_1_open, sat_1_close, sun_1_open, sun_1_close, mon_2_open, mon_2_close, tue_2_open, tue_2_close, wed_2_open, wed_2_close, thu_2_open, thu_2_close, fri_2_open, fri_2_close, sat_2_open, sat_2_close, sun_2_open, sun_2_close.
    Notes on the children:
    • Each field is returned with time (in seconds since epoch). For example, 9:00 AM is represented as 406800
  • band_members - Members of the band, may be blank.
  • bio - biography field, may be blank.
  • hometown - hometown field, may be blank.
  • genre - genre of music. Contains the following children: dance, party, relax, talk, think, workout, sing, intimate, raunchy, headphones . Notes on the children:
    • Zero or more of them may be set
    • May be 1 or 0.
  • record_label - record label, may be blank
  • influences - influences, may be blank
  • has_added_app - Bool (0 or 1) indicating whether the page has added the calling application to their Facebook account.
  • founded - When company was founded, may be blank
  • company_overview - overview of company, may be blank
  • mission - Mission of company, may be blank
  • products - Company's products, may be blank
  • release_date - Release date of film, may be blank
  • starring - Who's starring in TV/Film, may be blank
  • written_by - Who wrote TV/Film, may be blank
  • directed_by - Who directed TV/Film, may be blank
  • produced_by - Who produced TV/Film, may be blank
  • studio - Studio Film was produced, may be blank
  • awards - Awards received by TV/Film, may be blank
  • plot_outline - Plot outline of TV/Film, may be blank
  • network - Network of TV show, may be blank
  • season - Season of TV show, may be blank
  • schedule - Schedule of TV show, may be blank

Example Return XML

<?xml version="1.0" encoding="UTF-8"?> <pages_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"> <page> <page_id>4846711747</page_id> <name>Kronos Quartet</name> <pic_small>http://profile.ak.facebook.com/object2/283/56/t4846711747_9511.jpg</pic_small> <pic_big>http://profile.ak.facebook.com/object2/283/56/n4846711747_9511.jpg</pic_big> <pic_square>http://profile.ak.facebook.com/object2/283/56/q4846711747_9511.jpg</pic_square> <pic_large>http://profile.ak.facebook.com/object2/283/56/4846711747_9511.jpg</pic_large> <type>MUSICIANS</type> <type>page</type> <website>http://www.kronosquartet.org </website> <location/> <hours/> <band_members>David Harrington. Violin John Sherba . Violin Frank Dutt . Viola Jeffrey Zeigler . Cello </band_members> <bio>For more than 30 years, the Kronos Quartet has pursued a singular artistic vision with a spirit of fearless exploration. <hometown>San Francisco, CA</hometown> <genre> <dance>0</dance> <party>0</party> <relax>0</relax> <talk>0</talk> <think>1</think> <workout>0</workout> <sing>0</sing> <intimate>0</intimate> <raunchy>0</raunchy> <headphones>0</headphones> </genre> <record_label>Nonesuch</record_label> <influences>Composers: John Adams, Alban Berg, John Cage Collaborators: Asha Bhosle, David Bowie, Cafe Tacuba </influences> <has_added_app>0<has_added_app> <founded/> <company_overview/> <mission/> <products/> <release_date/> <starring/> <written_by/> <directed_by/> <produced_by/> <studio/> <awards/> <plot_outline/> <network/> <season/> <schedule/> </page> </pages_getInfo_response>

FQL Equivalent

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

This function is similar (but returning in a slightly different format) to doing the following FQL query, with the appropriate parameters filled in:

SELECT name, website FROM page WHERE page_id IN (SELECT page_id FROM page_fan WHERE uid = <uid> AND type = <type>)

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.
102 The session key was improperly submitted or has reached its timeout. Direct the user to log in again to obtain another key.
103 The submitted call_id was not greater than the previous call_id for this session.
104 Incorrect signature.

Notes

You can call this method using a session secret, and not the application secret (for example, for a Facebook Connect site or desktop application).

reference