Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fetch more than 25 post messages

I'm trying to get all post messages using restfb, my code is as follows

public Connection<Post> publicSearchMessages(Date fromDate, Date toDate) {
    Connection<Post> messages = publicFbClient.fetchConnection("search",
            Post.class,
            Parameter.with("q", "Watermelon"),
            Parameter.with("since", fromDate),
            Parameter.with("until", toDate),
            Parameter.with("type", "post"));

    return messages;
}

This only gives latest 25 post messages.

Parameter.with("limit",100 )

If i set limit parameter, it gives 100 messages but i don't want to limit to fetching post messages. So,

Is there anyway I can get a full list of post messages matching the search criteria without setting limit parameter?

like image 983
diya Avatar asked Oct 29 '11 04:10

diya


2 Answers

Maybe you can try using a loop. FB can't get more than 1000 each time, so you can use the loop to get the whole feeds. Use the offset like this:

Parameter.with("limit", 1000));
Parameter.with("offset", offset));

Offset will be a variable and its value will be 1000,2000,3000...

like image 164
Zam Avatar answered Oct 15 '22 15:10

Zam


There is no way to fetch unlimited results from FB. The default limit is set to 25. As you know, you can change this using the limit parameter. I have not found an upper border for limit searching the web. Maybe, you can set it to a very high amount.

like image 22
micfra Avatar answered Oct 15 '22 14:10

micfra