How to get all the posts in a Facebook group without a limit.? It only returns 25..? - facebook

I have used the call
GroupId?fields=feed{full_picture,place,from,comments{message},message,likes.limit(0).summary(true)}
to get the stated data for my application. But this only returns 25 feeds/posts. I also tried and limit number &limit=number (number like 1000) appending to the above. Yet it returns only 25. How to get all the posts?

Search for "Traversing Paged Results" in the docs:
https://developers.facebook.com/docs/graph-api/using-graph-api#reading
https://developers.facebook.com/docs/php/howto/example_pagination_basic
Some API calls have a max limit, so paging would be the only reliable way to get all items.

Related

How to fetch all documents from a collection using Firestore API?

https://firebase.google.com/docs/firestore/use-rest-api#making_rest_calls
Hi,
I want to fetch all the documents from my collection using REST for reporting purposes.
I tried using list method in API explorer but I am only getting max 30 documents at a time and for next page I have to use the nextPageToken.
I have even tried giving the pageSize to 100, even then it is returning only 30 documents as it is for maximum number of documents to return. Is there any way I can fetch all documents?
I have around 3-4k simple documents.
The example here works for me: https://stackoverflow.com/a/48889822/2441655
Example:
https://firestore.googleapis.com/v1/projects/YOUR_PROJECT/databases/(default)/documents/YOUR_DOC_PATH?pageSize=300
You can use paging by finding the "nextPageToken" at the end of the json, then inserting it like so:
https://firestore.googleapis.com/v1/projects/YOUR_PROJECT/databases/(default)/documents/YOUR_DOC_PATH?pageSize=300&pageToken=NEXT_PAGE_TOKEN_HERE
However it still limits the max pageSize to 300 for me. (odd that it limits it to 30 for you)

Get total number of matches along with result in algolia

I am looking for something like FOUND_ROWS() in mysql select query in algolia results as I need to keep a track of how many total results to expect. Is there someway to get this in Algolia?
The proper way to obtain the number of results is to access the nbHits value which is available in the JSON response of every search call.

Facebook Graph Api: using limit with since and until

I am trying to use limit along with since and until in Graph Api call. In between a certain time interval, I have 2 uploaded photos. The query looks like this:
me/photos/uploaded?since=2009-12-31T18%3A30%3A00.000Z&until=2010-12-31T18%3A30%3A00.000Z&limit=200
This query has limit set as 200 , and it correctly returns the 2 photos. But the problem arises when I have a smaller value of limit, lets say 100. So basically a query:
me/photos/uploaded?since=2009-12-31T18%3A30%3A00.000Z&until=2010-12-31T18%3A30%3A00.000Z&limit=100
return me an empty json. Even though there are only two photos, a limit of 100 returns null. Any insights?

Search Facebook Graph API for long posts?

Is it possible to search the Graph API for posts a Facebook member has written where post.length > n ?
Or would I have to pull posts and parse/filter them in my code?
You can use FQL to make filtered Graph API calls.
This query will get you posts with a message containing the word "this" which are more than 50 characters long.
SELECT message, post_id FROM stream WHERE CONTAINS("this") and strlen(message) > 50 LIMIT 100
The CONTAINS() function is not documented. From my experimentation with it, it searches multiple fields and is optimized to return matches that are based on full names.

Query every liked object using FQL

I'm trying to query every object which the user has liked since joining facebook by running this query:
SELECT user_id, object_id, post_id FROM like WHERE user_id=me()
This query runs fine and returns some results, but the number of them is a lot less than I estimated. I tried it on different, real user accounts, and for a friend of mine who has joined facebook around 2006 the number of returned results is still only around 65.
I tried this query through the official javascript sdk and through the graph api explorer which gave identical results.
The documentation doesn't state any limit imposed upon querying the like table.
Is there anything, I should be aware when doing a query on this table?
Thank you very much!
According to this documentation :
Each query of the stream table is limited to the previous 30 days or
50 posts, whichever is greater, however you can use time-specific
fields such as created_time along with FQL operators (such as < or >)
to retrieve a much greater range of posts.
Although not explicitly mentioned in the doucmentation for likes, I guess this will be the same limit. So try to add created_time in a where clause.