What controls which user posts are visible via the Facebook Graph? - facebook

I'm making requests like the following:
https://graph.facebook.com/USER_ID/posts?access_token=TOKEN
When the TOKEN is from the Graph API Explorer (from https://developers.facebook.com/tools/explorer logged in as my own user account), I see some posts for most users.
When the TOKEN is a user token for my own app and my own user account, resulting from the client-side flow[*], I see { "data": [] } for almost everyone.
What could cause the difference? As far as I can tell, the two tokens were given the same permissions (I get identical returns from https://graph.facebook.com/me/permissions?access_token=TOKEN for the two tokens).
All I can think is that the users whose posts I'm looking for aren't users of my app, but perhaps everyone is magically a user of the API Explorer. But the info I want to see about them is visible to me, both on their user page and from Graph using the API Explorer token, so surely this can't be a security restriction: I can get a token that shows me the information I want, but my app can't. Hence:
why aren't the posts visible to me when using my app?
what do I do about it?
our current theory is that the API explorer has special privileges to access public data, and other apps can't get that. Is this really the case, or is there something I could do with my app to view public data via /posts?
[*] Using the URL: https://www.facebook.com/dialog/oauth?client_id=MY_APP_ID&redirect_uri=https://www.facebook.com/connect/login_success.html&scope=manage_pages,read_stream,read_requests,user_location,user_activities&response_type=token

I see what you are saying, I tested it myself and I get the same.
Here's what I think is going on, but it's just a guess.
From what I just tested, the data that comes back when using the graph explorer app is public data of the user, like new friends and public posts.
It's the same exact data I can see if I go to the profile of the user in facebook.
Why doesn't your app get that public data?
Well, facebook grant special privileges to certain apps, and in the case of the graph explorer, which is their app, it's not far fetched to think that they did just that.
To test the theory I removed all permissions I have for the graph explorer and tried to get the posts of a user which is not my friend, and indeed I got the same results.
When I tested it with "me/posts" I got my posts, and not just the public ones.
If you remove the permissions from your own app then even your posts will return with data: [].
Your app can only get the data for the logged in user and his friends.

Related

Facebook user profile pic no longer accessible?

(I'm aware of this question, but it's outdated to the point of no longer working, so asking again.)
With the Facebook API it used to be that all profile pictures were considered public, and you could get one for anyone without any access tokens like this:
https://graph.facebook.com/4/picture
Now in 2020 it seems that it only works for public images like Zuck there. I have a tool for Facebook page admins that shows a list of people who liked page posts, but when I try to show user pictures in the list they all now come up blank because "This object does not exist or does not support this action".
The docs now say "This document refers to a feature that was removed after Graph API v3.2". But I could not find any more information about this deprecation. Is it now just impossible to show the picture of a user without having a user access token, or has the way to call it just changed?
The feature has not been removed, but now for users that don't have their profiles set as public, you need to provide an access token.
For instance suppose you use the Page API to list all the people who commented on a post. Previously you could show the profile pics of commenters by just linking to https://graph.facebook.com/<UID>/picture. However now you need an access token for that Page, and to then access the pic as https://graph.facebook.com/<UID>/picture?access_token=<TOKEN HERE>.
I have not tested this with apps, but I would assume that also to get the profile pics of app users based on their app-scoped UID, you'd need to include an access token there as well.

Get list of events user is attending on Facebook

I'm trying to get list of events my friend / user attends. This info is publicly visible through Facebook pages.
I'm making a request to /userid/events but it returns empty array of results, though user does have upcoming events and calling /me/events is working. (all is ran in graph explorer)
I couldn't find any documentation about any limitations or required permissions to explain why it's not working e.g. this link
Is it a bug? How to workaround it?
You can use /userid/events with a user who auzhorized your App, but using /me/events is recommended. Either way, just because stuff is public on facebook.com does not mean you can get it with the API. You always need to authorize users before you can get any data, for privacy reasons.
In other words: It´s not a bug, there is no workaround, it´s not possible without user authorization.

Graph API sharedposts edge empty data issue

I'm facing a problem with /sharedposts edge it keeps returning empty array
{"data": []}
I'd like to share my case exactly with you, may be I'm doing something wrong.
I'm using Graph API Explorer / API ver 2.3
I'm trying to track a fan page post, and get the users' ids who shared this post
The page post is public
All the sharing is public too
My application has read_stream permission granted (at least on the testing users)
I even tried that when I'm the page Admin, App Admin, and I did the sharing myself to my timeline, all permissions are granted and I added manage_pages permission.
I tried using the {post_id}/sharedposts
I tried using the {page_id}_{post_id}/sharedposts
Based on other posts in this regard on StackOverflow, I added limit.
All the above trials, keep giving me the same results
{"data": []}
Please advise me what's wrong with my App, please if anybody has a successful experience with this issue please share, or advise me where could I find the problem?!!!
There seems to be a known bug with this API endpoint. The behaviour you're describing is the same as in this bug report: https://developers.facebook.com/bugs/1404733043148335/
The /sharedposts endpoint will -only- retrieve posts from users who have -also- granted your app. This means that even though a post might be public on a users' timeline, unless they have also granted your app permissions, you will not be able to retrieve that post.
For example: a user posted to a page and the post is public. This post can be retrieved with an access token. Let's assume that the user also shared this post to their own timeline. But, since the user has not granted permissions to your app, you will not be able to see this post using the /sharedposts edge on the original post (on the page). This also holds if the user shared their post publicly to his timeline.
This behaviour is by design; the API is more restrictive in returning user data than the website is. This holds for multiple endpoint and this is one of the examples where it is the case.

Facebook API for Share returning empty results set

I am new to Facebook API. I am building a Facebook app to fetch all the name of people who shared, commented and liked a post in a tabular format. I am able to get the like and comment details through Facebook API but can not find and proper API to get the share details.
I am using
https://graph.facebook.com/post_id?fields=sharedposts&access_token=my_access_token.
This API is returning an empty result set. And I have granted all the available permission to the access_tokn. Can anyone tell me ,Is there any other API that I can use. I saw a option of scraping the Facebook page for share,but I don't want to go that way because Facebook keeps on updating every thing.
I'm having the same problem as you, but I think I'm going a little step forward.
Try adding a limit to your sharedposts and maybe it will return some data:
Try this way:
https://graph.facebook.com/post_id/sharedposts?access_token=my_access_token&limit=1000
That should work for a regular post.
EDIT: Maybe the problem could be that althought you have granted all the perms to the token, the people who share that posts have to accept that permission too.
Otherway your JSON won't return any data.
The /sharedposts endpoint will -only- retrieve posts from users who have -also- granted your app. This means that even though a post might be public on a users' timeline, unless they have also granted your app permissions, you will not be able to retrieve that post.
For example: a user posted to a page and the post is public. This post can be retrieved with an access token. Let's assume that the user also shared this post to their own timeline. But, since the user has not granted permissions to your app, you will not be able to see this post using the /sharedposts edge on the original post (on the page). This also holds if the user shared their post publicly to his timeline.
This behaviour is by design; the API is more restrictive in returning user data than the website is. This holds for multiple endpoint and this is one of the examples where it is the case.
Source: https://developers.facebook.com/bugs/1404733043148335

Default FB search

I read documentation about FB API, and FB graph, and still not sure how to do something.
I'm creating unique client for FB and G+, and when i log in with some user (with no friends for example) I need to make default search, and to try to add friend.
However, when i do any kind of FQL search, i receive almost empty results, with no publicly shown data that i receive when i use FB mobile application, or just when i try to find someone on FB. Is there any chance to do that, and what kind of token i need to have.
It would be silly to create FB application, and wait for users to approve permissions for me, so later I can search for them, and add them as friends or so...
Is there any example, or any suggestion how to do that, i searched, and searched, and still nothing :(
Thanks in advance
Edit:
Well, i'm trying to use Graph API (i don't know if i can use any other).
I want to create application that i will be able to use as same application for facebook and google social network. So i need to login, and than to search for people (like in regular FB), and to add them as friends etc.
So, i'm trying to search for people with given string (i know that), to find info about user (i need permission and token, even if those info is public, or in other words, user needs to authorize my application, so i can later allow people who use my app to search for user, and have public info)
So, my question is, if there is any way to search user and his public info, available on FB application on mobile devices ?
Go to http://developers.facebook.com/docs/reference/api/ and CTRL+F for Searching section. You can use that to search for Facebook users.
But, as you said, you won't have the current user access_token, so you won't be able to perform the search. And if you try to use /search with an app access_token the response message is:
{
"error": {
"type": "OAuthException",
"message": "A user access token is required to request this resource."
}
}
So you need to create a Facebook App and get user permissions to perform the searches you want.