Events.get

From Facebook Developer Wiki

Jump to: navigation, search

Contents

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.

The uid can be replaced by gid in order to get events hosted by a group instead of by an individual user.

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

The 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.

This method no longer requires a session key. However if you call this method without an active user session, you can only get the events for which your application was the creator; you can see only those event attendees who authorized your application. Applications can create events for users if the users grant the application the create_event extended permission.

Parameters

RequiredNameTypeDescription
optional 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

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.

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>

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 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

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).

See Also

reference