At Facebook's core is the social graph; people and the connections they have to everything they care about. The Graph API presents a simple, consistent view of the Facebook social graph, uniformly representing objects in the graph (e.g., people, photos, events, and pages) and the connections between them (e.g., friend relationships, shared content, and photo tags).
Every object in the social graph has a unique ID. You can access the properties of an object by requesting https://graph.facebook.com/ID. For example, the official page for the Facebook Platform has id 19292868552, so you can fetch the object at https://graph.facebook.com/19292868552:
Alternatively, people and pages with usernames can be accessed using their username as an ID. Since "platform" is the username for the page above, https://graph.facebook.com/platform will return what you expect. All responses are JSON objects.
All objects in Facebook can be accessed in the same way:
- Users: https://graph.facebook.com/btaylor (Bret Taylor)
- Pages: https://graph.facebook.com/cocacola (Coca-Cola page)
- Events: https://graph.facebook.com/251906384206 (Facebook Developer Garage Austin)
- Groups: https://graph.facebook.com/2204501798 (Emacs users group)
- Applications: https://graph.facebook.com/2439131959 (the Graffiti app)
- Status messages: https://graph.facebook.com/367501354973 (A status message from Bret)
- Photos: https://graph.facebook.com/98423808305 (A photo from the Coca-Cola page)
- Photo albums: https://graph.facebook.com/99394368305 (Coca-Cola's wall photos)
- Profile pictures: http://graph.facebook.com/aslam843/picture (your profile picture)
- Videos: https://graph.facebook.com/614004947048 (A Facebook tech talk on Tornado)
- Notes: https://graph.facebook.com/122788341354 (Note announcing Facebook for iPhone 3.0)
- Checkins: https://graph.facebook.com/414866888308 (Check-in at a pizzeria)
All of the objects in the Facebook social graph are connected to each other via relationships. Bret Taylor is a fan of the Coca-Cola page, and Bret Taylor and Arjun Banker are friends. We call those relationships connections in our API. You can examine the connections between objects using the URL structure https://graph.facebook.com/ID/CONNECTION_TYPE. The connections supported for people and pages include:
- Friends: https://graph.facebook.com/me/friends?access_token=...
- News feed: https://graph.facebook.com/me/home?access_token=...
- Profile feed (Wall): https://graph.facebook.com/me/feed?access_token=...
- Likes: https://graph.facebook.com/me/likes?access_token=...
- Movies: https://graph.facebook.com/me/movies?access_token=...
- Music: https://graph.facebook.com/me/music?access_token=...
- Books: https://graph.facebook.com/me/books?access_token=...
- Notes: https://graph.facebook.com/me/notes?access_token=...
- Photo Tags: https://graph.facebook.com/me/photos?access_token=...
- Photo Albums: https://graph.facebook.com/me/albums?access_token=...
- Video Tags: https://graph.facebook.com/me/videos?access_token=...
- Video Uploads: https://graph.facebook.com/me/videos/uploaded?access_token=...
- Events: https://graph.facebook.com/me/events?access_token=...
- Groups: https://graph.facebook.com/me/groups?access_token=...
- Checkins: https://graph.facebook.com/me/checkins?access_token=...
We support different connection types for different objects. For example, you can get the list of all the people attending the Facebook Developer Garage at SXSW (ID #331218348435) by fetching https://graph.facebook.com/331218348435/attending?access_token=....
No comments:
Post a Comment