FQL get posts from stream on updated_time, need to find equivalen Graph API - facebook

FQL will be obsolete in API 2.1. If any user creates a new APP, then the user is forced to use API 2.1 features, as a result, I need to remove all FQL and replaced with Graph API to server the new users who create a new app.
Here is the quesion, We use FQL to fetch all posts on wall based on updated_time, and then we can fetch all newly comments reply to these posts on the page. This is the way we can fetch all the newer comments since last update. the FQL syntax look like this.
https://graph.facebook.com/v2.0/fql?q=SELECT post_id, comment_info FROM stream WHERE source_id = ' owner ' and updated_time >=' since
Does any one know the equivalent feature in Graph API. I have been looking documents but unable to find it. Please help in coming out an alternate approach to achieve the same functionality, Thanks.

There's unfortunately no equivalent in the Graph API. The since request parameter is relative to the created_time AFAIK.

Related

How to limit Facebook Graph API to only posts (not comments or likes) by user without using FQL?

I am trying to query the FB graph API for all of my posts. I would like the result set to only feature items that I've posted on my timeline. Not other users, and not my likes or comments.
The documentation is extremely confusing and most of the knowledge I've gained is through trial and error. To date, the only proposed solutions to this I've found online require the use of FQL (such as in this similar question: Facebook graph api- how to get user feed,with out posts about likes and comment by the user?) however the FB documentation states that FQL is deprecated and will not be supported in the future so I would like to avoid it. Additionally this is currently structured as a url request and if at all possible, I would like to keep it so.
To date, I've tried:
/[userid]?fields=posts.limit(100).fields( picture, link, created_time, from, message, description, object_id )
which will get me all of my posts with the data fields I require, but it also includes "Likes" and when I "Comment" anywhere - which I don't want.
/[userid]?fields=feed.limit(100).fields( picture, link, created_time, from, message, description, object_id )
which returns only posts - but also includes posts made by others on my timeline (and I don't want those either).
It seems unclear to me if there is any more robust way to work with these different feed types as documented:
https://developers.facebook.com/docs/graph-api/reference/v2.0/user/feed/
Can anyone tell if there is a way to either limit the "feed" edge to only my posts (not including others posting to my timeline) or filter the "posts" edge to remove the "likes" and "comments"?
Instaead of /feed, you can use /posts.
More info here:
https://developers.facebook.com/docs/graph-api/reference/v2.0/user/feed
It's not possible as far as I know to generally apply filters to the Graph API calls, except very little exceptions.
/user/feed is an example (https://developers.facebook.com/docs/graph-api/reference/v2.0/user/feed/#read), where you can specify either with=location or filter={stream_filter}.
{stream_filter} in this case is a result of the filter_key field of the following FQL query:
select filter_key, name from stream_filter where uid=me()
Maybe you can try
GET /me/feed?filter=app_2915120374
which should give you the status updates.

How to get Recent Activity using Graph API or FQL?

Is there a way to get Recent Activity using Graph API or FQL ? I'm talking about information that is available at this location: http://www.facebook.com/vanityname/allactivity?filter_onlyme=on
I coulnd't find anything in FB API documentation (not surprisingly). Scraping it from the web-site looks complicated as well because it's fetched by calling http://www.facebook.com/ajax/pagelet/generic.php/TimelineProfileAllActivityPagelet which returns very hard to parse content.
In case you guys wondering FQL that I tried is select post_id,actor_id,created_time,message,description,xid from stream where source_id = me()
There is no way to get this information in the API. In addition there is no documentation listed for this either at https://developers.facebook.com

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.

How to get Page's Posts by Others

I need to pull the 'Posts by Others' from my Facebook Page and display them on my site. Spent the afternoon fiddling around with the API and was able to see posts made by the page, but not others. Any ideas?
Steve, I just found another solution, you can use the Graph API using FQL.
Just make a call to the following:
https://graph.facebook.com/fql?q=SELECT post_id, created_time , app_data, type, actor_id, target_id, message FROM stream WHERE source_id = YOUR_PAGE_ID AND actor_id != YOUR_PAGE_ID&access_token=YOUR_ACCESS_TOKEN
If you need more variables, you just need to put them after SELECT, and you can check them out here: https://developers.facebook.com/docs/reference/fql/stream
On iOS, you don't need to put the access token in the query. To check how to do it with the latest iOS SDK, see my answer here: https://stackoverflow.com/a/14357179/675486
Got it, they are in the 'feed' field along with posts by the page. I was hoping for something that would just give posts by others, but I can filter out the ones posted by the page.

Facebook API: Can I access my page's user's content?

I'm trying to develop a management tool for my pages and to do that, I need access to the content my users post (as I repost a lot of their content - ex. photos)
It looks like I can get access to all the content that I post, but I can't seem to find any reference to features that'll allow me access to the user's content.
Is this not available in the API?
You can get all the posts for a page at:
https://graph.facebook.com/[PAGE_NAME_OR_ID]/feed?access_token=...
However, you can't filter on this very well. An option that gives you more control is FQL. This query of the stream table should get you started with posts by others.
SELECT post_id, actor_id, message, attachment, permalink FROM stream
WHERE source_id = [PAGE_ID] AND filter_key = 'others'
If a user has set their post to private, it won't be returned by this call. You also need to be aware of the limits of the stream table: It only returns up to 50 posts in the last 30 days. If you want more, you have to use a LIMIT clause to page through your results.
I am developing Facebook application from last two years as per my experience you can't get any users information and using Page Signed request you can get userid,isowner,timezone and isLiked only..