facebook graph api for public information - facebook

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.

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

How to access Instagram feed of any user with new Graph API?

Facebook recently introduced Instagram Graph API, which allows to fetch data from Instagram page that is connected to your Facebook company page, instagram.com/developers states:
The Instagram Graph API is Now Available to All Developers.
For Non-Business Instagram Accounts please continue to use the existing Instagram API.
So, for example, if my company has account instagram.com/my_first_company, I can only retrieve its feed and no one else.
Using old Instagram API to retrieve public_content permission (access to any feed) is no longer an option too, from old API documetation:
public_content - to read any public profile info and media on a user’s
behalf (applications no longer accepted)
What will happen to existing tools that have public_content permission? (for example, there are tons of plugins for various CMS that allow to display recent Instagram photos)
Is there any valid way to access public_content (access to any feed) right now (besides fetching HTML pages of Instagram website)?
Are there any plans to enable Graph API for non-business customers, of so when?
UPD. There seem to be ?__a=1 endpoint that allows to get access to recent photos of any public feed without any tokens. But it's not official and no one knows when/if Instagram will close it. If you do - please let me know.
UPD 2. Instagram removed ?__a=1 endpoint, not sure for how long, probably forever. Currently the only way to access instagram feed is to scrap instagram.com website, which is a horror.
Prerequisite: You first need the business Instagram account to be linked with FB Page. https://help.instagram.com/356902681064399 - That one can do from the profile page of Instagram account.
Get the Instagram business account id:
graph.facebook.com/v2.8/<fbPageId>?fields=instagram_business_account. (the fbPageId is the page id of the facebook page the account is linked)
To fetch instagram media feed: graph.facebook.com/v2.8/<igBusinessId>/media to fetch the media feed of the Instagram account. (the igBusinessId is the id returned in above linked instagram_business_account) - This is still owned media as per the page access_token. Not any other user's feed.
All other endpoints (such as comments moderation, detailed insights API) mentioned here works on the business media list returned on above call.
Please note:
This still does not allow to fetch un-authenticated user's Instagram feed. That is not possible via API now. There is no valid way via API to get to public_content scope. There can be few Instagram Marketing partners for which this is enabled. But, in general the scope is deprecated now!
Currently, for FB graph API to work we need linked business page to Instagram account. As above apis uses page tokens.
You can get information about any IG business account using your FB access_token using the business_discovery API as given here.
You must have an IG business account to read other users data like user_info or media details using the id of your IG business account as a node.
Ex:
GET graph.facebook.com/[YOUR-IG-BUSINESS-ACCOUNT-ID]?fields=business_discovery.username(USERNAME){media{caption,media_url,media_type,like_count,comments_count,id}}

How to get any user posts using facebook Graph API?

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.

Facebook Graph API: shouldn't /userId/subscribers list subscribers for non-friends?

From the docs: https://developers.facebook.com/docs/reference/api/user/#subscribers
I was testing on Graph API Explorer and noticed that I can't get the public subscribers list from a non-friend person through that API connection even when I can see them via http://www.facebook.com/userId/subscribers page.
It retrieves only the summary info with total_count, nothing on data. Am I missing something or it's unsupported by design?
Thanks!
Yes this is by design, the API doesn't reflect the public interface, it's best not to think about it like this. Always see the permissions needed
You can read the subscribers for a user for your app by issuing an HTTP GET request to /USER_ID/subscribers with the user access_token with the user_subscriptions or friends_subscriptions permission.
So as it says you can only read the authenticated user and the user's friends with the correct permissions.

Get facebook post made by my application and the number of likes/comments on it

I have a facebook application that I use to post messages on user's wall. I save the post id. I want to know the number of likes and comments on each of these posts?
Do I need a read_stream permission to access my own posts?
What is the best way to do this?
You will need read_stream permission from the user to be able to read the post since the user owns their own status update (and its likes/comments), not your application. If you have read_stream, you can then just access /postID via the Graph API.