我试图让从Facebook FQL使用我的直系亲属数据。 我跑这条语句:
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'))
但我想也有数据的relatioship。 它给我的只有FIRST_NAME,middle_name,姓氏,birthday_date
你必须做一个得到这个数据,你需要做的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
在你的脚本。
你需要使用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/..."
}
}
}
希望帮助。 玩得开心。