Upload
felix-rivas
View
1.369
Download
0
Embed Size (px)
Citation preview
DESARROLLO DE APLICACIONES
APIFQL
XFBMLGraph
http://developers.facebook.com/docs/reference/fql/
FQL
http://developers.facebook.com/docs/reference/rest/fql.query
album comment cookies connection event event_member friend friend_request friendlist friendlist_member group group_member link
metrics note page page_admin page_fan permissions photo photo_tag profile standard_user_info status stream stream_filter user
FQL Tables
ALGUNOS MÉTODOS ÚTILES
NOMBRE QUÉ HACEN
now() Retorna la hora actual.
rand() Genera un numero aleatorio.
strlen(string) Retorna la longitud de una cadena.
concat(string, ...) Concatena cadenas
substr(string, start, length)
Obtiene una subcadena.
strpos(string, string_interna)
Retorna la posicion de una cadena. dentro de otra, si no la halla retorna -1. Es case sensitive.
lower(string) Convierte la cadena a minúsculas
upper(string) Convierte la cadena a mayúsculas.
Extraer 10 nombres de mis amigos
SELECT uid2 from friend where uid1= MI_UID ORDER BY rand() LIMIT 10
Extraer mi fecha de cumpleaños y dónde vivo
SELECT concat(first_name," ","cumple anios en ",birthday," y vive en ",hometown_location.city) from
user where uid=MI_UID
Extraer la fecha de cumpleaños y lugar dónde viven 5 amigos
SELECT concat(first_name," ","cumple anios en ",birthday," y vive en ",hometown_location.city) from
user where uid in (SELECT uid2 from friend where uid1= MI_UID ORDER BY rand() LIMIT 5)
Extraer nombres de los grupos a los que pertenezco
SELECT name FROM group WHERE gid IN (SELECT gid FROM group_member WHERE uid = MI_UID)
Extraer los nombres de mis amigos que cumplen anios hoy
SELECT name FROM user WHERE strpos(birthday, “MES DIA") = 0 AND uid IN (SELECT uid2 FROM
friend WHERE uid1 = MI_UID)
Realizar los Siguientes QUERYS
1.-Extraer los nombres de los grupos que tu compartes con un amigo(aleatorio)
2.- Extraer los nombres de los amigos que sus cumples son hoy y tienen 22 anios
Respuesta de QUERYS
1.-Extraer los nombres de los grupos que tu compartes con un amigo(aleatorio)
SELECT name FROM group WHERE gid IN ( SELECT gid FROM group_member WHERE uid=MI_UID AND gid IN (SELECT gid FROM group_member WHERE uid in (SELECT uid2 from friend
where uid1= MI_UID ORDER BY rand() LIMIT 1)))
Respuesta de QUERYS
2.- Extraer los nombres de los amigos que sus cumples son hoy y tienen 22 anios:
SELECT name FROM user WHERE strpos(birthday, “MES DIA, ANIO") = 0 AND uid IN (SELECT uid2 FROM friend WHERE uid1 =MI_UID)
Graph Api
XFBML
http://wiki.developers.facebook.com/index.php/XFBML
http://developers.facebook.com/docs/reference/fbml/
Rendering XFBML
In order for the user's browser to correctly recognize XFBML tags, you need to specify that the page is in XHTML. Within the <html> tag, add this attribute:
Rendering XFBML
In each file, you need to refer to the Facebook JavaScript Feature Loader file, FeatureLoader.js.php. This will allow your site access to all of the features of Facebook Connect in JavaScript, like XFBML, JavaScript API calls, and so forth. This script should be referenced in the BODY of your file, not in the HEAD (for the best performance, put this code right after the <body> tag in the file.).
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> </head><body><script type="text/javascript"
src="http://connect.facebook.net/en_US/all.js"></script><script type="text/javascript"> FB.init({ appId MyAppId, status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true // parse XFBML });</script></body></html>