20
DESARROLLO DE APLICACIONES

Facebook's Apps II part

Embed Size (px)

Citation preview

Page 1: Facebook's Apps II part

DESARROLLO DE APLICACIONES

Page 2: Facebook's Apps II part

APIFQL

XFBMLGraph

Page 3: Facebook's Apps II part

http://developers.facebook.com/docs/reference/fql/

FQL

http://developers.facebook.com/docs/reference/rest/fql.query

Page 4: Facebook's Apps II part

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

Page 5: Facebook's Apps II part
Page 6: Facebook's Apps II part
Page 7: Facebook's Apps II part
Page 8: Facebook's Apps II part
Page 9: Facebook's Apps II part

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.

Page 10: Facebook's Apps II part

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)

Page 11: Facebook's Apps II part

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)

Page 12: Facebook's Apps II part

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

Page 13: Facebook's Apps II part

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

Page 14: Facebook's Apps II part

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)

Page 15: Facebook's Apps II part

http://developers.facebook.com/docs/api

Graph Api

Page 16: Facebook's Apps II part

Graph Api

Page 17: Facebook's Apps II part

XFBML

http://wiki.developers.facebook.com/index.php/XFBML

http://developers.facebook.com/docs/reference/fbml/

Page 18: Facebook's Apps II part

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:

Page 19: Facebook's Apps II part

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>

Page 20: Facebook's Apps II part

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