In Facebook Graph API - how can I know how many albums a facebook user has?
I'm tryi开发者_如何学编程ng to determine if I should show a "next" or "previous" links to the user, in case there are more albums.
When calling /me/albums?limit=5
for example, for some weird reason the pagination "previous" and "next" links are returned even if there's only one album with a limit of 1000 (trying to exaggerate to prove the point) which is not what happens when I do /me/friends?limit=5
- in which case I only get a "next" or a "previous" link/data, if there is any.
If I had a way to know how many albums the user has, I could calculate how many "next" the user clicked, and show or not show the "next" or "previous" links.
You could use FQL to count the number of albums a user has here is the FQL statement that I would use:
SELECT aid FROM albums WHERE owner=me();
Then just use the length of the array that is returned. Check out the documentation
精彩评论