Events.get

From Facebook Developers Wiki

Jump to: navigation, search

Contents

[edit] Description

Returns all visible events according to the filters specified. You can use this method to find all events for a user, or to query a specific set of events by a list of event IDs (eids).

If both the uid and eids parameters are provided, the method returns all events in the set of eids that are associated with the user. If no eids parameter are specified, the method returns all events associated with the specified user.

If the uid parameter is omitted, the method returns all events associated with the provided eids, regardless of any user relationship.

If both parameters are omitted, the method returns all events associated with the session user.

start_time and end_time parameters specify a (possibly open-ended) window in which all events returned overlap. Note that if start_time is greater than or equal to end_time, an empty top-level element is returned.


[edit] Parameters

RequiredNameTypeDescription
required api_key string The application key associated with the calling application.
session_key string The session key of the logged in user.
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 authentication guide.
v string This must be set to 1.0 to use this version of the API.
optional format string Desired response format. Either XML (default) or JSON.
callback string Name of a function to call. This is primarily to enable cross-domain JavaScript requests using the <script> tag, also known as JSONP, and works with both the XML and JSON formats. The function will be called with the response passed as the parameter.
uid int Filter by events associated with a user with this uid.
eids array Filter by this list of event IDs. This is a comma-separated list of event IDs.
start_time int Filter with this UTC as lower bound. A missing or zero parameter indicates no lower bound.
end_time int Filter with this UTC as upper bound. A missing or zero parameter indicates no upper bound.
rsvp_status string Filter by this RSVP status. The RSVP status should be one of the following strings:
  • attending
  • unsure
  • declined
  • not_replied


[edit] Example Return XML

<?xml version="1.0" encoding="UTF-8"?> <events_get_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"> <event> <eid>1037629024</eid> <name>Technology Tasting</name> <tagline>Who said Engineering can't be delicious?</tagline> <nid>12409987</nid> <pic>http://photos-628.facebook.com/ip006/object/1345/48/s1037629024_30775.jpg</pic> <pic_big>http://photos-628.facebook.com/ip006/object/1345/48/n1037629024_30775.jpg</pic> <pic_small>http://photos-628.facebook.com/ip006/object/1345/48/t1037629024_30775.jpg</pic> <host>Facebook</host> <description>Facebook will be hosting technology thought leaders and avid software engineers for a social evening of technology tasting. We invite you to connect with some of our newest technologies and innovative people over hors d'oeuvres and wine. Come share ideas, ask questions, and challenge existing technology paradigms in the spirit of the open source community.</description> <event_type>Party</event_type> <event_subtype>Cocktail Party</event_subtype> <start_time>1172107800</start_time> <end_time>1172115000</end_time> <creator>1078</creator> <update_time>1170096157</update_time> <location>Facebook's New Office</location> <venue> <street>156 University Ave.</street> <city>Palo Alto</city> <state>CA</state> <country>United States</country> </venue> </event> </events_get_response>


[edit] Response

Events are only visible if they are not secret. If no such events are found, the method returns an empty events_get_response element. The nid field will be 0 for global events.

Note the following size constraints on photos returned:

  • pic - URL of event photo, with max width 100px and max height 300px. May be blank.
  • pic_big - URL of event photo, with max width 200px and max height 600px. May be blank.
  • pic_small - URL of event photo, with with max width 50px and max height 150px. May be blank.

Privacy note: Event creators are visible to an application only if the creator has not turned off access to the Platform or used the application. If the creator has opted out, the creator element appears in the following format:

<creator xsi:nil="true"/>

Note that the start_time and end_time returned are the times which were input by the event creator, converted to UTC after assuming that they were in Pacific time (Daylight Savings or Standard, depending on the date of the event), then converted into Unix epoch time.


[edit] FQL Equivalent

This function is similar to doing the following FQL query, with the appropriate parameters filled in:

SELECT eid, name, tagline, nid, pic, pic_big, pic_small, host, description, event_type, event_subtype, start_time, end_time, creator, update_time, location, venue FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid=uid AND rsvp_status=rsvp_status) AND eid IN (eids) AND end_time >= start_time AND start_time < end_time


[edit] 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.
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.
Navigation