我尝试使用FQL从facebook获取我的直接家庭数据。我运行这个声明:
SELECT first_name, middle_name, last_name, birthday_date
from user
where uid IN (SELECT uid
FROM family
WHERE profile_id = me()
and (relationship = 'brother'
or relationship = 'sister'
or relationship = 'father'
or relationship = 'mother'
or relationship = 'son'
or relationship = 'daughter'
or relationship = 'wife'
or relationship = 'husband'))
但我想在数据中也有关系。它只给我 first_name,middle_name,last_name,birthday_date
答案 0 :(得分:1)
您必须执行a来获取此数据,您需要执行FQL多查询:
{"my_family": "SELECT uid, relationship FROM family WHERE profile_id = me() AND
(relationship = 'brother' OR ...)".
"family_details": "SELECT first_name, middle_name, last_name, birthday_date FROM
user WHERE uid IN (SELECT uid FROM #my_family)"}
您需要在脚本的uid
上将两个结果对象连接在一起。
答案 1 :(得分:0)
您需要使用FQL吗?现在有一个嵌套的字段图谱API语法,可以一次性获取您所需的内容:
https://graph.facebook.com/me?fields=id,name,family.fields(first_name,middle_name,last_name,birthday)
然后,结果是一个嵌套的JSON对象,其中包含您需要的关系字段 - 类似于:
{
"id": "738229837",
"name": "James Pearce",
"family": {
"data": [
{
"first_name": "Bob",
"last_name": "Pearce",
"birthday": "09/21/1965",
"id": "12345",
"relationship": "cousin"
},
{
"first_name": "Clara",
"last_name": "Pearce",
"birthday": "12/08",
"id": "67890",
"relationship": "mother"
}
...
],
"paging": {
"next": "https://graph.facebook.com/..."
}
}
}
希望有所帮助。玩得开心。