I need get ME posts in one of my manage pages, with the new version of facebook sdk.
Example:
I'm manage on Page A, and add a post in my name Adexe Rivera, and in this page there are a lot of posts. So I want to filter only posts by Adexe Rivera.
I know for get posts on pages it's necesary /page/feed, but I need add the filter from user.
I tried with Graph Api Explorer, with this FQL:
SELECT source_id, actor_id, post_id, target_id, message FROM stream WHERE source_id = "PAGE_ID" AND actor_id = "MY_ID"
and get the information that I'm searching.
But I know that since v2.0 FQL not works for sdk, so that I need it's make the same like FQL works in this version of graph
I already tried what documentation said, but not get my posts.
A user access token is required to retrieve posts visible to that person.
Thanks in advance
Filtering is not possible, you can only use the existing endpoints and filter on your own after getting the entries. There are several different endpoints, make sure you are using the correct one. They are all documented very well: https://developers.facebook.com/docs/graph-api/reference/v2.4/page/feed
Also, an App Access Token should be enough to get access to the endpoints if it´s a public post on a non-restricted Page:
An access token is required to view publicly shared posts.
If you don´t know about Access Tokens, read those articles:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/
Finally, it is not possible to use FQL giving me the expected result, so getting the "from" field in the /PAGEID/feed endpoint, and filtering the results, I get what I wanted.
Thanks for your answers and for their penalties, I have spent several days trying to maximize the performance of the SDK facebook.
Cheers
Related
I'm using Graph API to fetch my page feeds. I call
$pageID/feed?fields=created_time,object_id,story_tags,story,full_picture,picture,message_tags,message,caption,child_attachments,attachments,description,admin_creator,from
It gives me the feeds in my page which is fine. But, I also want the list of posts where anyone has mentioned my page in their posts in their own walls. I have gone through https://developers.facebook.com/docs/graph-api/reference/v2.9 but could not find a way to do that. Does anyone has any idea if that is possible?
If yes, then how?
There is the /{page-id}/tagged endpoint; but that will only return posts by other pages that have tagged yours, and only if those pages are “authentic” (which likely means verified.)
And user posts are not available at all to your app, not even if they are public - unless the user explicitly granted your app permission to read their posts.
I like to get comments of a post by its URL but it seems its impossible by using graph API.
From my observations, I could find these types of posts URLs:
https://www.facebook.com/bbwbooks/photos/a.168788885097.122872.74209335097/10153736545150098/?type=3&theater
https://www.facebook.com/4thirteengroup/posts/1285218878169361
https://www.facebook.com/groups/semsari.malezi/permalink/1159959294084128/
or perhaps some other types.
Is there any idea, how its possible to get comments or at least the ID of the post from the url?
First use facebook developer section https://developers.facebook.com/tools/explorer/1021611514583622?method=GET&path=me%2Fposts%3Ffields%3Did%2Cobject_id%2Ccomments&version=v2.7
Select Application ,
Get access_token with user_posts access rights,
me/posts?fields=id,object_id,comments by calling this api ,you will get all posts with their comments
Currently i'm working on a website for a client.
I want to show his latest Facebook wall posts on his website, also posts he is tagged in by others.
With the Facebook Graph i can get allot of data from the latest post like message, description, picture etc. But i just can't find or get the Facebook id of the person who tagged him in that post... Only his own Facebook id and the id's of the others persons who where tagged, but not the tagger (if that is even a word :P)
Can anybody help me with this?
I'm using /feed in the Facebook Graph to get the data from the posts on his wall
$fb_id = 'your-facebook-id';
$fb_token = 'my-acces-token'; // tokken obtained from Facebook graph explorer page
$fb_response = file_get_contents('https://graph.facebook.com/'.$fb_id.'/feed?access_token='.$fb_token);
$fb_array = json_decode($fb_response, true);
Thanks for your time!!
If I understand you correctly, you just need to find the ID of a user that posted a status update that tagged your client.
Do things as you were before, by collecting objects from the /user/feed edge. You should retrieve an ID for the status. With this, make another call to the Graph for /STATUS_ID. This will give you information about who posted the status along with other things.
https://developers.facebook.com/docs/graph-api/reference/v2.1/post
Note that this will only work for public posts with any valid access token. If the post is not public, you may not be able to retrieve the post with a user's access token that is not the original user who posted the status. Keep in mind that the docs specifically state:
Only posts whose authors have also granted read_stream permission to the app will be shown for /user/feed.
I can get a list of comments and likes just fine using the facebook sdk. But i can't
find a way to get a list of all the users that shared a post (i tried fql as well).
This is the code i used to get the likes:
$facebook = new Facebook($config);
$likes = $facebook->api('/THE_POST_ID/likes',
array('limit'=>9999999999));
At the time of writing this, Facebook Graph API allows you to get the count of shares of a post. Using your code, it would look like the following (please not that I'm not doing any exception handling here for keeping the example simple):
$facebook = new Facebook($config);
// fetch the post data.
$post = $facebook->api('/THE_POST_ID/');
// fetch the count of shares.
$sharesCount = $post["shares"]["count"];
Using the Graph API Explorer you can easily see that.
Unfortunately, the API does not provide a "shares" connection like it does for "likes" and "comments". See Post - Facebook Graph API Documentation for details.
On the other hand, there is a dirty hack for retrieving the list of users (only friends and people who shared publicly) who shared a specific post. The solution is explained on another thread: List of people who shared on facebook. But, I would never suggest using that solution.
Yes you can get list of all the shares of a facebook post.
by accessing:
https://graph.facebook.com/{POST_ID}/sharedposts?access_token={ACCESS_TOKEN}
See:
https://developers.facebook.com/docs/graph-api/reference/v2.5/post
I know you're looking to get at shares through the post_id, but can you settle for finding shares by page_id instead of post_id?
If you can, then you can use the following FQL to get the data you're looking for.
SELECT via_id, created_time, owner_comment
FROM link
WHERE owner = me()
You can then compare via_id against the posts author (page ID) to determine if this share came from the post author in question.
Unfortunately, there seems to be a bug with the data return where some of the via_ids come back as 0. There is a ticket in with Facebook which, at the time of this post, has been open for three weeks at medium priority. I have no idea if this issue is specific to my app or affects everyone, but that query might get you what you want.
I'd like to fetch statuses from users facebook newsfeed via the graph API.
It seems to be pretty simple when I have the right access token, then I can fetch this data with http://graph.facebook.com/home... But I want to fetch only statuses; no links, photos, videos and so on..
On the documentation page, I've seen many possibilities to specify selected data, for example I can limit obtained count of posts. Is there any possibility to control which data will be particularly fetched and which not? For example like graph.facebook.com/home?type="status"..
I can classify it in my PHP script, but then I need to be able to fetch a few more posts, like when I click on the more button on facebook or twitter, etc..I see some pagination data in Facebook JSON(I hope it's JSON:)), but I am propably not capable to use it in right way..
Thanks for your help!!
The doc page http://developers.facebook.com/docs/api says:
The Graph API allows you to read properties and connections of the Facebook social graph. You can use the API to read specific fields, get pictures of any object, introspect an object for metadata and get real-time updates on any changes.
...and...
You can choose the fields (or connections) you want returned with the "fields" query parameter. For example, this URL will only return the id, name, and picture of Ben: https://graph.facebook.com/bgolub?fields=id,name,picture