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?
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...
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With