Get the new comments after a particular comment Facebook API - facebook-graph-api

I am getting Facebook posts and their comments from the facebook graph API (I cannot use FQL). I am able to save the posts and their comments successfully into my database. However, I am not able to get the new comments where are there on the post which I dont have in my tables. I tried
postid/comments?time=2014-04-13T00:00:00+0000
postid/comments?since=2014-04-13T00:00:00+0000
postid/comments?since_id=001122334455
but it is still not giving me records after that date. I also referred this post but it does not has a solution.

If you convert your time to a unix time stamp, then it should work.
For instance, the Unix timestamp for the time above is 1428935421
postid/comments?since=1428935421
http://www.onlineconversion.com/unix_time.htm

Related

Facebook Graph API does not return old post comments if we use since

I am trying to get the feeds from facebook using grpah API by these steps:
Created one post in FB at 24-06-2017 9:00 AM.
I included a since parameter = - 1 day in request.(that means need all the feeds (25-06-2017 9:00 AM onwords) from from API).
Called API to get list of feeds at 26-06-2017 9:00 AM.
Did not get any feeds from API why because did not find any posts in between 25-06-2017 and 26-06-2017.
Now create a comment for existing (24-06-2017 day) post.
Now again fetch the details with same request param(since=-1 day).
Did not get feeds from API response why because API is considering always post created time not updated time.
Our expectation is we should get the feed with updated comment details.
Right now API is considering only post created_time not updated_time.
Please help me to resolve this issue.
To get all the desired information you should have a look at the Facebook Webhooks (https://developers.facebook.com/docs/graph-api/webhooks). They notify your application if a new post or comment is made and you can then poll the needed information, because you have to right ids.
There is no way to resolve your problem with simple polling the Graph API. At least without running into request limits ...

Facebook Graph API collect posts only recently updated

I am currently collecting all page posts via the api using the since parameter i.e.
12345678910/feed?since=[LastCheckTimeUnix]
However I need to know if any earlier posts have been updated, using the updated_time field.
The only way I can see is to collect every post ever posted and then check the updated_time. However this is obviously inefficient. Is there a way to obtain all posts with an updated_time > LastCheckTime?

Fetch comment from specific user on a page post?

With FQL being deprecated, is there an alternative graph-y way of fetching the post-comments from a specific user without resorting to downloading all comments first and enumerating them?
Before I could just trigger an FQL statement like
SELECT text FROM comment
WHERE post_id = '<postid>' AND fromid = '<uid>'
But since that is no longer supported without using the older API, I'm wondering if there's an alternative for v2.1 and up?
Why? I organise a fair amount of give-away-contests on Facebook and have a script that retrieves the amount of likes from the announcement post, picks a number of random ones and then retrieves the comments of those users on that same post.
As a side remark: I hate it that I as a page owner cannot retrieve a list of people that liked my own page via the API. I still have to check that manually each time.
Unfortunately there's no way to filter the comments by user directly with the current Graph API version.
If you're using a v2.0 app, you can still use FQL until August 7th 2016. I'd wait and see if FB amends the Graph API with similar functionality as FQL had in the future.

How To Get Historical "Facebook Page Likes" Data via Graph API or FQL

Was wondering if anyone knows how to get the historical data for any Facebook Page.
For example, number of fans for RedBull fan page on a given day in the past or for a given period that ends today so that I can show fan development of any page over a given period.
I tried it with the graph API and FQL (insights) but no luck.
https://graph.facebook.com/{USERNAME}/insights?fields=likes&period('week')&end_time_date('2011-06-26') --> empty result
Pulling the data via FQL also returns no results, plus it seems without a read_insights permission nothing is possible for page data
I'd need this to be available with only a generic user access token. This data is publicly available anyway. Result should be somewhat like this: http://www.socialbakers.com/facebook-pages/australia/
https://graph.facebook.com/{{pagename}}/insights/page_views?access_token={{access_token_key}}&since=1420070400&until=1421625600
Since & until parameter in the above code takes in unix time.
add necessary information in the {{ }} and this code should work.
Without insight permission I recommend that you write something to perform a nightly query on the page graph and record the stats you need. If the page is public most of the information shown on that site is available.
You could also scrape info from http://pagedata.appdata.com if the page has already been listed...

reading and paging through the user's stream (home) using the graph api

I am trying to read a user's stream using the facebook graph api. the call is:
https://graph.facebook.com/me/home?access_token=xxxxx&since=yyyyy
I am getting a response but there are a few problems:
The result I get as a response is not identical to the stream I see as a facebbok user (many posts are missing - on facebook page, in the news feed, i can see much more posts than i get back in the response)
It seems that even if I use the "since" parameter, many of the posts returned are out of the time scope. Any ideas why? I would like to do paging according to specific time periods but it seems facebook api is not working as expected (it will return results earlier than the "since" parameter and it will not return all the posts i can see in my news feed).
thanks
It's easy to get these two connections from the user graph API object confused.
me/home is for the user's news feed
me/feed is for the user's wall
I would suggest using FQL via the Graph API and poll the stream table directly:
fql?q=SELECT post_id, comments, message FROM stream where source_id=me()
I'm pretty sure there's a bug logged at developers.facebook.com/bugs for the since parameter not working as expected.