How can I filter by message in all comments of a page post with graph api facebook? - facebook

This post have over 300000 comments and I want to filter which has my key.
I use this api to get all comment, then filter in local, but the maximum comments I receive is 5000.
graph.facebook.com/{post_id}/comments?fields=id&limit=1000000
How can I get all comments without limit (for post page have over million comments)?
Thank

Use a lower limit and use paging instead: https://developers.facebook.com/docs/graph-api/using-graph-api/#paging
You need to be careful with API limits though.

Related

Get share count from Graph API efficiently

I am trying to get information about a set of user posts (last 20 posts). For each post, I would like to simply get likes, comments and shares count.
So far I was able to get the like and comment count, but I had no luck in retrieving the share count.
This is the query I used:
https://graph.facebook.com/me?access_token=x&limit=20&fields=id,comments.limit(0).summary(true),likes.limit(0).summary(true)
I understand that there are ways to retrieve the share count using the object id, but I would like to refrain from making 20 different requests in order to obtain this field.
Is there any other way that I can make a single batch request to achieve this?
You can get share count through engagement field of the object, as mentioned here : https://stackoverflow.com/a/5700882/533399
For batching your requests, graph api already supports batch requests :
https://developers.facebook.com/docs/graph-api/making-multiple-requests

Getting the number of Facebook likes for a URL

I know there are several related answers on SO, but none seem to answer my question.
I would like to know if there is way to get the number of likes for a URL, using Graph API 2.2.
I know how to obtain this info via FQL or REST API, but those are deprecated.
https://graph.facebook.com/?ids=some_url
This returns the number of "shares", which is a total of like + shares + whatever. I need only the number of likes.
https://graph.facebook.com/some_opengraph_id/likes?summary=true
This returns the number of likes, but that total seems to be much lower than what a query on FQL link_stat table would return. Also /likes returns a list of likes, but it doesn't seem to be a complete list.
So is it possible to do this via Graph API or only FQL / REST support this?
Thanks in advance!
I encountered the same behavior, but unfortunately afaik there are no other options currently. If you have a v2.0 app, you can continue to use FQL until August 7th, 2016.

What is facebook's Page / Checkin Pagination limit on search?

I can't seem to find it in the documentation anywhere, and only seem to return 50 results when querying.
https://graph.facebook.com/search?q=coffee&type=place&limit=100&offset=200
Any and all requests to Facebook's API has a default limit of 50. You can add a limit=X parameter to any request you make to the Graph API.
For example, to get 300 results from a users feed, you would use something like this:
https://graph.facebook.com/USER_ID/feed?limit=300

what is the limit for the # of returned objects in graph.facebook.com/me/likes?

I need to get ALL user likes at once without pagination.
I could hit: graph.facebook.com/me/likes ...however, is there a limit to the # of objects returned by facebook? if so, what is that limit and can it be overwritten?
The default limit is something like 25 results. You can specify a limit by providing a limit parameter to facebook:
https://graph.facebook.com/me/likes?limit=100
Checkout the API Documentation under the heading "Paging".
That said, there's never a guarantee that you'll get all the likes at once, even if you set the limit parameter to be greater than or equal to the number of likes on an object.
On top of that, you'll often find that the number of likes reported on the Facebook website or by the Graph API is higher than what you can get by fetching the /likes connection in the Graph API. I'm trying (and failing) to find the SO question that talked about why that is, but if I remember right that number sometimes includes shares and other actions, not just likes.
You should use the pagination to page thru all the data that the Graph API can return.

Getting more than 25 photos from the Facebook Graph API

I'm trying to retrieve all the photos a user is tagged in using the Graph API but I can only get the latest 25.
Is it possible to get more, and if so, how?
Have you tried adding a limit and offset parameters? Quoting the documentation:
Paging
When querying connections, there are several useful parameters that enable you to filter and page through connection data:
limit, offset: https://graph.facebook.com/me/likes?limit=3
until, since (a unix timestamp or any date accepted by strtotime): https://graph.facebook.com/search?until=yesterday&q=orange
Currently there is 100 items limitation per query both on photos and likes:
However, 100 pics query takes so much time to run for me.
The following API call:
https://graph.facebook.com/me/photos?limit=500
gives only 100 results with paging link.
Run in FQL explorer (If you have more than 100 pic on your account):
https://developers.facebook.com/tools/explorer/?method=GET&path=me%2Fphotos%3Flimit%3D500
Setting limit=0 may not always work in the case that a user has a huge number of tagged photos. Also note that the tagged photos graph API can return a large number of embedded comments as well, so especially if you are developing a mobile app, it can take a long time to return all the photo data. Finally I find that sometimes Facebook will limit the number of entries it can return in times of high load.
So... perhaps the best way is to use the "paging" "next" url that appears at the end of the returned photo data. This gives you the next graphAPI call that you can then use to get the next x photos. It does this by using and pre-populating the limit and until parameters and incorporating them within the graph api call. Very handy.