Facebook Graph API get page's comment - facebook

Using Facebook Graph API, I want to get that all comments that presents in a page and filter them based on datetime.
I've read this thread, but it doesn't help as expected.
I can get all post and limit using date for specific page e.g.:
graph.facebook.com/110432309005026/tagged?since=<unix timestamp>
Now I want to do the same to search all comments.
This is how I do so far:
graph.facebook.com/110432309005026/tagged?fields=comments{id,from,message,created_time}
But how to filter the date of comment (not the date of post) ?
For example, I want to get all comment since '2015-04-25 00:00:00' for all posts on my page.
Need your advice

You can't do what you are looking for exactly however, what you could do is also look into just filtering the posts returned by the /tagged endpoint using the since parameter.
Since you are only looking for comments from a certain date when you fetch the posts from a certain date then the comments can ONLY be from that date. Your request will look like this instead:
graph.facebook.com/110432309005026/tagged?fields=comments{id,from,message,created_time}&since=2015-04-25

Related

Getting Facebook page posts of the last hour/day etc

Is it possible to specify a time span for the posts returned by GET /v2.x/{page-id}/feed?
For example, I want all the posts of the last hour and only those...
EDIT: Just found the since and until fields for the feed. However, this only seems to apply to posts, not to comments on those posts...
Any way to apply the time span to both posts and comments, regardless?
Ideally, I would get a chronological list of messages (whether posts or comments) for the last X time units.
Graph API returns comments in same order as selected on actual post|picture|etc..
I already searched alot about this. Then i went for a stupid but simple solution. I can show you if you are willing to made 2 requests to graph api to get comments

FB: How to get count of post according to date

I am trying to make some statistics and I need to get count of all posts(not only posts of friends) on facebook on specific day via GraphApi.
Any help appriciated
You can only search through public objects with the Graph API.
https://developers.facebook.com/docs/reference/api/search/
This is how you get all recent public posts:
https://graph.facebook.com/search?q=*&type=post
BUT!
The post search does not support limit/offset paging.
It means that you won't be able to search back through older posts for a given date using since and until.

Facebook Api getting feeds and comments

I'm trying to get the feeds on a public wall and the associated comments.
So every X minutes I'm doing a query in order to get what's new (feeds and comments).
I need the feeds (the new feeds since myDate) and comments (comments posted on the new feeds and comments posted on older feeds).
So if someone posted a comment on a older feed I want to get it.
I tryied to do this using FQL and Graph API but I don't manage to find the best solution.
With FQL there are some problems (bugs) with LIMIT and OFFSET and does not work very well.
With the Graph API I don't have so much power.
So this is what I've tryied:
https://graph.facebook.com/PAGE_ID/feed?access_token=MY_ACCES_TOKEN0&limit=500&since=1350033469&until=now&updated_time>1350033469
This gives me the newest post, so no problem because for each one I'm doing a new query in order to get the comments for each feed:
https://graph.facebook.com/PAGE_ID/comment?access_token=MY_ACCES_TOKEN0&limit=500&since=1350033469&until=now&updated_time>1350033469
The problem is that if a comment is posted on a older post, I don't receive it.
Using FQL I cannot filter only the newest posts (based on my since date) and the posts with new comments.
https://api.facebook.com/method/fql.query?query=SELECT post_id, text, fromid FROM comment WHERE post_id IN (SELECT post_id FROM stream where source_id=PAGE_ID and comments.created_date>1350033469)&access_token=MY_ACCES_TOKEN
Using Graph API I have a good pagination (using next and previous links inside the response) but with FQL I did't find any solution.
So anyone have some idea ?
Thanks.
C.C.
First, the FQL is deprecating, so you need to use only the Graph API.
The solution that I came with, is that when you already have a post, you need to recheck the post with its unique ID, and that request gives you two times, created_time and updated_time, so you need to check if your updated_time changed.
The pagination given in the Graph API is for only posts, so when posts have new comments, they won't come first in the list, you need to find them yourself.
-- UPDATE --
Use batch_requests to achieve this, so you can make more requests at a time.

Retrieve Facebook users information by date

I am using the following query to retrieve a particular Facebook users wall information:
https://graph.facebook.com/MY_USER_ID/feed?access_token=MY_ACCESS_TOKEN
Now from the above query, I need to list information which are after a particular updated_time. I am having the date in UTC format. say, 1333620660
Can you please suggest how to do so?
Thanks.
You can filter feeds by using since parameter.
https://graph.facebook.com/MY_USER_ID/feed?access_token=MY_ACCESS_TOKEN&since=1333620660
Edit (after comment):
Same way, you can use until parameter
https://graph.facebook.com/MY_USER_ID/feed?access_token=MY_ACCESS_TOKEN&since=1333620660&until=1333620890
Refer (the paging section):
http://developers.facebook.com/docs/reference/api/

Graph api - Like / until - since

Is there a possibility to use the parameters "since" and "until" in the likes request?
What I'm trying:
https://graph.facebook.com/me/likes?limit=500&offset=0&since=2011-01-01&access_token=...
I liked a post today, but it is not working. It can only show 2 pages which I liked in the past.
When using FQL, it is working as expected, but the "since" nor "until" parameter are working..
Also tried with FQL, but can't get it working:
https://graph.facebook.com/fql?q=' . rawurlencode('SELECT object_id FROM like WHERE user_id = me() LIMIT 500') . '&access_token=...
I think it is not possible to use those parameters on a like, am I correct?
Have a look at the documentation for pagination, which is here.
At the time of this answer it says...
"The following Graph API connections are cursor-based with more coming soon:
/photos
/albums
/links
/notes
/admins
/comments
"
and it looks like there is already a bug filed requesting that '/likes' be added to the list as noted (it can be found here)
HOWEVER...
The likes come back in chronological order so you don't have to gather all of them to find the ones since a particular date. I've got no idea if you can count on this or not so use this at your own risk.
(A side note: I dream of the day when Facebook actually grows up enough to deliver a mature API.)