I am new to facebook graph. I manage to access all the posts using:
https://graph.facebook.com/THEPAGE/posts?access_token=MYTOKEN
But this list all posts. How to get visible posts only? Or how to determine if post is hidden on the page?
Thanks!
As long as you've requested the read_stream permission, every post object will include a privacy field which specifies who can view that post. You can filter the posts on the client based on this field.
You're probably only interested in the value field of the privacy specification, which is one of EVERYONE, ALL_FRIENDS, FRIENDS_OF_FRIENDS, CUSTOM, or SELF. For example, posts which are visible to everyone will have {"value":"EVERYONE"} in the privacy field.
There is a parameter include_hidden that you can send on each request:
https://graph.facebook.com/THEPAGE/posts?include_hidden=false&access_token=MYTOKEN
Related
I see the API has fields for getting comments given a post/photo/page id. Is there a field to grab a all comments made by a user?
something like this /me?fields=comments?
No, comments are always bound to another resource (post, photo, ...). There is no API to get ALL comments made by the user.
Recently, when using the /feed Facebook Graph API method, it has stopped returning the From field. This field typically contains the Id and Name of the author of the Facebook Post in question.
The URL I'm hitting is https://graph.facebook.com/{id}/feed?fields={my-fields-here}&access_token={token}
From what I can tell, the From field still exists within the API: If I try https://graph.facebook.com/{id}/feed?fields=id,from&access_token={token} I get a list of IDs (no Froms though), without errors.
However, if I try a deliberately-invalid field name, such as https://graph.facebook.com/{id}/feed?fields=id,doesnotexist&access_token={token} then I get an error response of (#100) Unknown fields: doesnotexist.
So the From field still exists as far as the Facebook Graph API is concerned. It's just no longer being returned. Did something change recently? The From field is also still listed as the list of fields over on their documentation. As far as the data itself goes, posts dating months back also no longer have From, so it's not a case of "newer posts in the feed lack the field, but older posts do either."
I'm at a loss! If anyone could lend a hand, I'd appreciate it.
It is only included if you use a Page Token. v2.11 of the Graph API (90-Day Breaking Changes):
/page/* — User information will not be included in GET responses for
any objects owned by (on) a Page unless the request is made with a
Page access token. This affects all nodes and edges that return data
for objects owned by a Page.
Source: https://developers.facebook.com/docs/graph-api/changelog/version2.11
...or in the link of your question:
Any valid access token can read posts on a public Page, but responses
will not include User information.
A Page access token can read all Posts posted to or posted by that Page, and responses will include User information.
Hi,
As title, in my facebook group, I need to retrieve only post without comments.
I see the search box and notice that searching something will give an url with
`?query=Word%20Search`
and maybe there is a way to search post without comments by url.
Thanks for help!
You must use the Graph API to retrieve data from Facebook. There is example code how to get the group feed in the docs: https://developers.facebook.com/docs/graph-api/reference/v2.2/group/feed#read
You can´t filter by posts without comments, you need to do the filtering on your own after getting the posts.
I wanted my application to post a status on users wall which should be seen only by the persons in that locale? How is it possible to restrict it in facebook apis?
The documentation for a Post has a detailed list of all fields, one of them is the "privacy" which controls who will see the post, it says:
object containing the value field and optional friends, networks,
allow, deny and description fields. .... The description field may
contain a comma-separated lists of valid country, city and language if
a Page's post targeting by location/language is specified.
I recommend that you go and check it out since it has much more text written on this field.
I tried several options:
https://graph.facebook.com/me/likes ,
https://graph.facebook.com/me/links
and a couple of FQL queries - but none returned Likes a user makes via Like buttons on external sites.
Any ideas?
You just take the Extended Permission of user_likes, you will get what you are looking for....
I think that user_likes only give you the permission to see all real objects that the user likes:
a movie,a musician...
if a page is tagged as article for example:
it won't be shown in the likes request
https://graph.facebook.com/me/likes
cause there is no object in the social graph for it:
"Note that the Open Graph protocol is currently designed to support real-life objects. If your URL is a piece of content — such as a news article, photo, video, or similar — you should set og:type to article (see below). Pages of type article do not have publishing rights, and will not show up on user's profiles because they are not real world objects."
(http://developers.facebook.com/docs/opengraph/)
I am also looking for the same api request, I'll let you know if I'll find it...
Editing:
Ok I asked this question on Facebook:
http://forum.developers.facebook.net/viewtopic.php?id=94745
and there is no way of doing that.