How to compose request which is retrieve wall posts posted by my application or at least I want to get ALL posts posted by any application or user. Now I can see only posts from myself and friends : me?fields=feed with permission read_stream. If it impossible withGraph API how to do this with FQL ?
select message from stream where source_id = DESTINATION ID and app_id= YOUR APP ID
If you want to filter by stuff your app is posting you have to find the id that your app is posting on. This is the "soure_id" ie where your post is going. Then you just have to add the parameter of what your app_id is that your app is posting as. If you wanted to filter by user you would just insert their uid as the actor_id instead of app_id.
Related
I'm trying to load a single page post data from Facebook. As you may know some posts have IDs like PAGE_ID + '_' + POST_ID and some have just POST_ID. When I have Page_ID and Post_ID available (I get these IDs from ad creatives), and want to get the post data, I don't know if I should call
https://graph.facebook.com/POST_ID
or
https://graph.facebook.com/PAGE_ID_POST_ID
Is there a normalised way on graph api to get post data? Should I make another request if one of the above fails?
A post_id is a universal unique id in the Facebook Grap. For as answer to your question:
https://graph.facebook.com/POST_ID
The post_ids have indeed sometimes some logic that is like pageid_postId. But don't think about it. PostId is uuid in Facebook.
And if you have more questions or issues you can easily the GRAP explorer and enter whatever id and check the result:
https://developers.facebook.com/tools/explorer
And enter the id in the text field after the GET dropdownlist.
I am currently making a Facebook canvas app using Django and Python for Facebook. To be able to make my app I need to retrieve the posts the user have made to his friends' walls. This has proven to be a challenge.
I have tried using the connection user.posts with the graph API like this:
graph = facebook.GraphAPI(access_token)
posts = graph.get_connections('me', 'posts' , limit=5000)
Which in the graph explorer would be something like:
graph.facebook.com/me/posts
The post objects from this request does however not return any posts from the user on his friend's walls.
I also tried an FQL query which didn't return anything, at least not with myself as the user:
SELECT actor_id, message, post_id, source_id, tagged_ids, type
FROM stream WHERE type=56 AND source_id IN (SELECT user_1 FROM friend WHERE user_2=me())
I'm pretty sure that I could get what I wanted if I did a request for each friend separately but that would be too time consuming to be efficiently implemented. Does anyone have any ideas on how to do this in one or two calls?
By link-like I mean a generic page on the Web (link) that a user likes using a Facebook button (i.e. NOT a Facebook standard page).
The Graph API method /user/feed does not return link-likes.
The Graph API method /user/likes only returns Facebook page likes, but not link-likes.
Do you know of any ways that I could get to link-likes?
When you get this kind of entry you get and id something like:
"id": "1392236262_349397875123264"
The first part of id is user id, the second is the liked link id. You can get an information about it by running other Facebook Graph API call:
https://graph.facebook.com/349397875123264
This way you will get all information about this link.
You can get list of liked urls using fql:
SELECT url FROM url_like WHERE user_id = me()
http://developers.facebook.com/docs/reference/fql/url_like/
I was wondering how to build a FQL query where i could receive links/urls of my app that an user's friends have liked. I got the link table which looks good but there i need an object id, which i dunno how to retrieve for my urls.
You can get the object id from the object_url table.
https://developers.facebook.com/docs/reference/fql/object_url/
Using the Facebook API with the FQL language, how can I get a list of the users that liked a given URL? I got the URL and want to query Facebook to see how many people and what users liked that URL.
Using PHP or ASP.Net... doesn't matter, just want to know how to write the FQL query.
Sadly this data isn't available. What's possible via the Link Graph API objects and the link FQL table is just retrieving a given instance in which a link was shared by a user. You can get the count of likes on a user's posting of a link, but this likely isn't what you want.
Discussed this 3-6 months ago with guys at Facebook, and the consensus then was also that getting this data via API is impossible. As far as I know things haven't changed, and there are some privacy arguments for keeping this data out of the API.
'SELECT user_id FROM like WHERE object_id IN (SELECT link_id from link WHERE url = 'YOUR URL HERE' AND owner = 'YOUR USER ID HERE' '
Like FQL Table
Link FQL table
In order to access user's likes, the application needs to have user_likes permission from the user. After that if you access http://graph.facebook.com/me/likes with appropriate access tokens, all the object IDs (including external websites), the current user has liked will be listed.
(this is in reply to bounty question, which seems a bit different from the original question asked on this page)
It's not using FQL but...you can see the most recent 500 users that have like your page by going to: https://www.facebook.com/browse/?type=page_fans&page_id={id} but you would have to scrape this to get the information and it won't work for more people besides the most recent 500. Here's the gotcha, you've gotta be an admin of the page_id to see it.
You can only get the fans of pages that you are an administrator for. So you have to provide an access token with your request associated with an admin account of the page you are trying to get the fans.
Facebook's FQL documentation here: https://developers.facebook.com/docs/reference/fql/page/ tells you how to do it. Run the example SELECT name, fan_count FROM page WHERE page_id = 19292868552 and replace the page_id number with your page's id number and it will return the page name and the fan count.