![](/img/trans.png)
[英]How do I get the list of mutual friends on Facebook using their API?
[英]How do I fetch a list of Facebook names from a list of Facebook IDs with one API call?
我從數據庫中獲取了約100個Facebook ID,並將其存儲在Javascript數組中。
對於這些,我想獲取一些數據,例如全名,但是我不想進行超過100次的API調用。
我現在正在使用的是:
$.get('https://graph.facebook.com/'+id+'?fields=id,name',function(d){ d.name; });
我希望存在:
$.get('https://graph.facebook.com/?fields=id,name&list='+myList.join(','),function(d){ d[0].name; });
或使用Javascript SDK的類似工具。 提前致謝。
一種方法是僅在查詢字符串中提供ID:像這樣的早期Facebook員工:
https://graph.facebook.com/?ids=4、5、6、7、8
我有很多ID,最好限制響應以加快速度。 這只為您提供姓名+性別:
我想到了一種方法來做,並且效果很好:
FB.api('fql', { q: 'select name from user where uid in ('+mylist.join(',')+')' }, function (response) { response.data[0].name; });
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.