开发者

Getting more than 25 photos from the Facebook Graph API

I'm trying to retrieve a开发者_如何学编程ll the photos a user is tagged in using the Graph API but I can only get the latest 25.

Is it possible to get more, and if so, how?


Have you tried adding a limit and offset parameters? Quoting the documentation:

Paging

When querying connections, there are several useful parameters that enable you to filter and page through connection data:

  • limit, offset: https://graph.facebook.com/me/likes?limit=3
  • until, since (a unix timestamp or any date accepted by strtotime): https://graph.facebook.com/search?until=yesterday&q=orange


Currently there is 100 items limitation per query both on photos and likes: However, 100 pics query takes so much time to run for me.

The following API call:

https://graph.facebook.com/me/photos?limit=500

gives only 100 results with paging link.

Run in FQL explorer (If you have more than 100 pic on your account): https://developers.facebook.com/tools/explorer/?method=GET&path=me%2Fphotos%3Flimit%3D500


Setting limit=0 may not always work in the case that a user has a huge number of tagged photos. Also note that the tagged photos graph API can return a large number of embedded comments as well, so especially if you are developing a mobile app, it can take a long time to return all the photo data. Finally I find that sometimes Facebook will limit the number of entries it can return in times of high load.

So... perhaps the best way is to use the "paging" "next" url that appears at the end of the returned photo data. This gives you the next graphAPI call that you can then use to get the next x photos. It does this by using and pre-populating the limit and until parameters and incorporating them within the graph api call. Very handy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜