tags:

views:

27

answers:

1

Hello,

I have a problem with API call on Facebook Graph API. This API call (with the php-sdk):

$posts = $facebook->api('/me/posts?since=2010-1-1&until=2010-3-31T23:59:59');

returns empty array, that looks like this using var_dump : { ["data"]=> array(0) { } }

If I modify the call like this:

$posts = $facebook->api('/me/posts?since=2010-1-1');

it returns the right posts. If I modify it like this:

$posts = $facebook->api('/me/posts?until=2010-3-31');

It returns empty array again. However, this

$posts = $facebook->api('/me/posts?until=2010-12-31');

works fine (but for different posts, than I want).

All of the above, with "statuses" or "links" instead of "posts", return non-empty array.

What is going on?

+2  A: 

I think you are hitting infamous 5000 limit. Facebook acts like if you always have only latest 5000 records. So if your 5000th entry from top was newer than 2010-3-31 it won't return anything for /me/posts?until=2010-3-31 query.

Run /me/posts query and look at the bottom item. Facebook won't return anything older than it no matter what extra query parameters you supply (undocumented feature).

serg
Thanks for your idea.... but I don't post that much. It would mean I posted 5000 posts during the last 5 months, which counts for about 34 posts a day, which is way more than I post.However, if all the "likes" and "comments" are counted, too, it can make sense.
Karel Bílek
@Karel run `/me/posts` and look at the bottom item. Facebook won't return anything older than it no matter what extra query parameters you supply.
serg
Plus, as I said, links and statuses works fine.
Karel Bílek
@serg: oh, that's right (even the "previous" link, that is provided by facebook, doesn't return anything). Do you think it's a facebook bug? And where should I report it?
Karel Bílek
@Karel it's a feature that looks like a bug (and not documented anywhere). If you have time then report it, maybe they will do something about it finally (there probably already a few reports).
serg
@serg is there any other place to report facebook bugs except the forum? edit: nevermind, I see the bugzilla
Karel Bílek
@serg: edit your answer to include your first comment and I will accept it
Karel Bílek
@Karel ok thanks.
serg

related questions