Niranjan
Niranjan

Reputation: 172

Paging in Facebook FQL

I am trying to get all the chat conversations of an user. I get the access token and directly query the facebook tables(no graph api,just plain FQL).FQL Guide

This is the query I am using

select body,thread_id from message where thread_id in (select thread_id in thread where folder_id=0 or folderid=1)

I am not getting the entire result though. I have tried Offset and Limit but not sure till what condition I should iterate this(How do I find the end??).

Also how to use since and until in FQL?? something like select thread_id from thread where folder_id=0 since =UNIXTIMESTAMP (this doesnt work!!!). How do I get this going?

Upvotes: 0

Views: 1963

Answers (1)

Lix
Lix

Reputation: 47956

You could try using the created_time field of the message table to limit the requests by time and control limiting results for each request.

For all the threads between 16/8/2011 00:00 and 16/8/2011 23:59 (my birthday) :

SELECT body,thread_id FROM message WHERE thread_id IN  
  (SELECT thread_id FROM thread WHERE folder_id=0 OR folder_id=1)  
AND created_time > 1313452800 AND created_time < 1313539140`

It would be better for performance on your end if you control the pagination... Through the Graph API Explorer, I was able to get +-750 threads, but I have no idea what (if any) limits apply. I think it would be safe to say that there would be a limit.

Upvotes: 2

Related Questions