- The
Friends.get [63]
returns the identifiers of
the current user's Facebook friends.
- You call it like:
http://api.facebook.com/restserver.php?method=Frients.get&api_key=YOURKEY
&session_key=YOURSK&call_id=123&sig=MD5HASH&v=1.0
&format=XML
- which will return something like:
<?xml version="1.0" encoding="UTF-8"?>
<friends_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">
<uid>222333</uid>
<uid>1240079</uid>
</friends_get_response>
[222333,1240079]
- The
Photos.get [64]
returns all visible photos according to the filters
specified.
- You send:
http://api.facebook.com/restserver.php?method=Photos.get&api_key=YOURKEY
&session_key=YOURSK&call_id=123&sig=MD5HASH&v=1.0
&subj_id=USERID
&format=XML
- To find all photos tagged by user USERID. You can
similarly find all photos in an album (
aid
) or in
a list (pids
).
- It returns
<?xml version="1.0" encoding="UTF-8"?>
<photos_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">
<photo>
<pid>34585991612804</pid>
<aid>34585963571485</aid>
<owner>1240077</owner>
<src>http://ip002.facebook.com/v11/135/18/8055/s1240077_30043524_2020.jpg</src>
<src_big>http://ip002.facebook.com/v11/135/18/8055/n1240077_30043524_2020.jpg</src>
<src_small>http://ip002.facebook.com/v11/135/18/8055/t1240077_30043524_2020.jpg</src>
<link>http://www.facebook.com/photo.php?pid=30043524&id=8055</link>
<caption>From The Deathmatch (Trailer) (1999)</caption>
<created>1132553361</created>
</photo>
<photo>
<pid>34585991612805</pid>
<aid>34585963571485</aid>
<owner>1240077</owner>
<src>http://ip002.facebook.com/v11/135/18/8055/s1240077_30043525_2184.jpg</src>
<src_big>http://ip002.facebook.com/v11/135/18/8055/n1240077_30043525_2184.jpg</src>
<src_small>http://ip002.facebook.com/v11/135/18/8055/t1240077_30043525_2184.jpg</src>
<link>http://www.facebook.com/photo.php?pid=30043525&id=8055</link>
<caption>Mexico City, back cover of the CYHS Student Underground 1999.</caption>
<created>1132553362</created>
</photo>
</photos_get_response>
You set your callback (URL) for each of these on the facebook website. They all require you to send back different markup.
- The Faceebook
query language [81] provides and alternate API.
- It's SQL-like:
SELECT name, pic FROM user WHERE
uid=211031 OR uid=4801660
.
- The tables include:
- user
- friend
- group
- event
- photo
- album
- listing
- page
SELECT name, affiliations FROM user
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=211031)
AND "Facebook" IN affiliations.name AND uid < 10
SELECT src, caption, 1+2*3/4, caption, 10*(20 + 1) FROM photo
WHERE pid IN (SELECT pid FROM photo_tag WHERE subject=211031) AND
pid IN (SELECT pid FROM photo_tag WHERE subject=204686) AND
caption
Results in
<?xml version="1.0" encoding="UTF-8"?>
<fql_query_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>
<name>Mark Zuckerberg</name>
<affiliations list="true">
<affiliation>
<nid>50431648</nid>
<name>Facebook</name>
<type>work</type>
<status/>
<year/>
</affiliation>
<affiliation>
<nid>16777217</nid>
<name>Harvard</name>
<type>college</type>
<status>Undergrad</status>
<year/>
</affiliation>
<affiliation>
<nid>67108894</nid>
<name>San Francisco, CA</name>
<type>region</type>
<status/>
<year/>
</affiliation>
</affiliations>
</user>
<user>
<name>Chris Hughes</name>
<affiliations list="true">
<affiliation>
<nid>50431648</nid>
<name>Facebook</name>
<type>work</type>
<status/>
<year/>
</affiliation>
<affiliation>
<nid>16777217</nid>
<name>Harvard</name>
<type>college</type>
<status>Alumnus/Alumna</status>
<year>2006</year>
</affiliation>
<affiliation>
<nid>67108869</nid>
<name>Washington, DC</name>
<type>region</type>
<status/>
<year/>
</affiliation>
<affiliation>
<nid>67108894</nid>
<name>San Francisco, CA</name>
<type>region</type>
<status/>
<year/>
</affiliation>
</affiliations>
</user>
<user>
<name>Dustin Moskovitz</name>
<affiliations list="true">
<affiliation>
<nid>50431648</nid>
<name>Facebook</name>
<type>work</type>
<status/>
<year/>
</affiliation>
<affiliation>
<nid>16777217</nid>
<name>Harvard</name>
<type>college</type>
<status>Undergrad</status>
<year/>
</affiliation>
<affiliation>
<nid>16777219</nid>
<name>Stanford</name>
<type>college</type>
<status>Staff</status>
<year/>
</affiliation>
<affiliation>
<nid>67108894</nid>
<name>San Francisco, CA</name>
<type>region</type>
<status/>
<year/>
</affiliation>
<affiliation>
<nid>67108896</nid>
<name>Silicon Valley, CA</name>
<type>region</type>
<status/>
<year/>
</affiliation>
<affiliation>
<nid>67109006</nid>
<name>Ocala, FL</name>
<type>region</type>
<status/>
<year/>
</affiliation>
</affiliations>
</user>
</fql_query_response>
<?xml version="1.0" encoding="UTF-8"?>
<fql_query_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">
<photo>
<src>http://photos-923.ak.facebook.com/ip002/v61/188/75/206412/s206412_31508923_7923.jpg</src>
<caption>celebrating 23 years of ari's life at the one and the oasis.</caption>
<anon>2.5</anon>
<caption>celebrating 23 years of ari's life at the one and the oasis.</caption>
<anon>210</anon>
</photo>
<photo>
<src>http://photos-447.ak.facebook.com/ip005/v40/164/17/202965/s202965_30849447_4635.jpg</src>
<caption>Liar's Dice...</caption>
<anon>2.5</anon>
<caption>Liar's Dice...</caption>
<anon>210</anon>
</photo>
<photo>
<src>http://photos-480.ak.facebook.com/ip005/v29/188/75/206412/s206412_30452480_140.jpg</src>
<caption>the crew. (RishDAWG!)</caption>
<anon>2.5</anon>
<caption>the crew. (RishDAWG!)</caption>
<anon>210</anon>
</photo>
<photo>
<src>http://photos-103.ak.facebook.com/ip001/v12/188/75/206412/s206412_30325103_6676.jpg</src>
<caption>group photo!!!!</caption>
<anon>2.5</anon>
<caption>group photo!!!!</caption>
<anon>210</anon>
</photo>
<photo>
<src>http://photos-399.ak.facebook.com/ip001/v10/188/75/206412/s206412_30191399_9134.jpg</src>
<caption>someone is particularly happy to be in this picture</caption>
<anon>2.5</anon>
<caption>someone is particularly happy to be in this picture</caption>
<anon>210</anon>
</photo>
<photo>
<src>http://photos-716.ak.facebook.com/ip007/v16/129/99/204686/s204686_30190716_7256.jpg</src>
<caption>One of the most extravagant.</caption>
<anon>2.5</anon>
<caption>One of the most extravagant.</caption>
<anon>210</anon>
</photo>
</fql_query_response>