How to get any user posts using facebook Graph API? - facebook

I only can reach to my posts with API but I can not reach to friends posts so I want to fetch all the public posts from a user with my user access token.
to be clearer I want to get the users post AND his friends posts.

You can't. For privacy reasons, the Facebook API won't give you most information unless the user who owns that information - not their friends, even if it's technically part of the "public profile" - explicitly grants permission by connecting to your application with the right permissions.

Related

How to get my own Facebook user timeline using Graph API?

I would like to get all the posts and updates that are normally displayed in FB official application for MY account (this includes updates from my friends and liked pages).
I wasn't able to find any details how to get that, the only thing I've managed to get is my own posts.
Anyone got any experience with that using current Graph API verion (3.3)?
All the alternate FB clients (ex. Friendly) must be doing this somehow.
There is no way to get ANY data of users who did not authorized your App. Which means, there is no way to get posts of friends. You can only get your own friends, with the user_posts permission and the /me/posts endpoint. If some Apps access friend data without their authorization, they are most likely doing something that is not allowed.
Here is what I found in their API docs:
There are two scopes:
The user feed requires the user's permission
The public feed has fewer capabilities but doesn't require perms

Facebook show friends posts

One of our feature is to display the posts of our facebook friend. And that is made possible by Facebook Query Langauge FQL. Unfortunately FQL has been deprecated by FB in favor of Graph API which has stricter permissions. A possible replacement is the Graphs API user_posts permission where we can query user posts via user feed.
However the docs says:
"Your app needs user_posts permission from the person who created the post or the person tagged in the post."
Are there still alternative to get get user posts even without users permissions?
You only should be able to access friend's posts if your friends gave at least user_friends and user_posts permission to the same app.
If so, you'll only have access to those friend's posts, not to all your friends. An no, there's no workyround. Facebook did this on purpose with the introduction of the Graph API v2.0.

Restrict facebook app from accessing user's friends list

I am using facebook to login to my website. The website does not need any information about the facebook user's friends' list. I am interested only in the user's general information.
https://developers.facebook.com/docs/reference/login/public-profile-and-friend-list/ shows the friend list also as the minimum information shared by Facebook.
Hence wanted to check if there is any way to restrict the user friend list information from being passed on from facebook to my application?
No, when a user authorize an application the minimum data shared is it's basic information and friend list.
Unfortunately you cannot change this.
Official documentation:
When someone connects with an app using Facebook Login, the app can
access their public profile and friend list, the pieces of information
that are visible to everyone. Each other piece of information that
someone adds to their Facebook profile is secured behind permissions.
Source: Facebook

Getting friend user id, and their photos

I am doing some research into the capacity of Facebook Connect. I have some questions on how a couple of bits of functionality.
Is it possible to fetch a list of all friends of a user?
The idea of this is that a user would log in using my site and then they could search through their friends and select one, and the site would get that friends users id and store it to the sites database.
Getting a photos from that user
After getting the friends user id, would it then be possible to get their photos? Or would the friend need to give the site permission to do that?
I am looking into a site where you can buy a greetings card for a friend, and i wanted to know whether my users would be able to login via facebook, pick a friend, get a photo and then at the time of their birthday it would send them a private message (which i think i know how to do) linking them back to my site where they could view the birthday card and their photo.
Thanks
To answer your questions:
Yes. Once you have an access token from the login process for a user, make a Graph API request to https://graph.facebook.com/me/friends. You can test this for yourself here: https://developers.facebook.com/tools/explorer?method=GET&path=me%2Ffriends
Yes. During the login process, you must request user_photos and friends_photos permissions after which you can use the access token for a Graph API request to https://graph.facebook.com/USERID/photos. This will only return those photos for a friend which the user is allowed to see for the current privacy settings.

facebook graph api for public information

I am able access the wall (public) contents of an unknown person through graph API, but not his info.
graph.facebook.com/xyz.abc/feed&access_token=yadayadayada
Why do I need the user's permission (oauth) to get his info through graph when it is available on facebook.com/xyz.abc/?sk=info
Am I doing it wrong?
You are not doing it wrong, that is just the Facebook API's policy and how it has always worked. To get user info from the API, a user has to approve it or one of their friends has to approve it.