仅获取朋友的total_count-facebook-graph-api [英] Get only the total_count of friends - facebook-graph-api
问题描述
me?fields=friends
获取
{
"friends": {
...
"summary": {
"total_count": 72
}
},
...
}
我只想要total_count
,但是看来这不是我可以在查询中输入的有效子字段
I just want total_count
, but it seems it isn't a valid sub-field I can put in the query
me?fields=friends{summary}
或me?fields=friends{total_count}
不起作用.
这不是绝对必要,只是好奇为什么不这样做或是否可行?
Not an absolute necessity, just curious why not or whether it's possible?
推荐答案
字段扩展仅适用于对象的字段.
Field expansion only works on the fields of an object.
因此,如果对象属于用户类型,则可以扩展的字段在 https://developers.facebook.com/docs/graph-api/reference/v2.1/user
So if the object is of type user, the fields that can be expanded are listed at https://developers.facebook.com/docs/graph-api/reference/v2.1/user
示例
me?fields=friends{name,link}
如果您要减少为提高性能而返回的数据,则可以尝试使用限制来确保在返回摘要部分的同时不返回任何朋友(数据数组为空)
If you are trying to decrease the data returned for performance, you can try using the limit to ensure that no friends are returned (the data array is empty) while still obtaining the summary section
me?fields=friends.limit(0)
这篇关于仅获取朋友的total_count-facebook-graph-api的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!