Get data from other user_id with facebook graph API v3.2 - facebook

I would like to know if it is possible to get basic data (name, posts...) of user in Facebook that has public profile (obviously).
I tried with GRAPH API this call:
https://graph.facebook.com/v3.2/USER_ID?fields=id,name&access_token=access_token
When I use my profile USER_ID, it returns my id and my name, but when I put another user ID, it returns this error:
Unsupported get request. Object with ID 'USER_ID' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https:\/\/developers.facebook.com\/docs\/graph-api
But I reed in documentation that the variable user_id can use in this API call, so I think that this is posible (maybe no).
I reed in other posts, that in the past you can access by username, but now no. Maybe, you only can access to your profile data?
Thanks and sorry about my english.

No, you can not access just anyone’s profile data via API, even if it is shown publicly on the website or the official apps.
The user would need to explicitly login to your app and grant it permission to access their data. Those permissions can not be granted on behalf of someone else - every single user you would want any info about, would have to do this personally.

Related

Add extended permissions - Facebook

I created a Java program that retrieves users personal information and posts. I can retireve everything related to me but not to my friends.
I know that i have to add some extended permissions to collect information about my friends (e.g. friends_groups, friends_interests, friends_subscriptions and more) but i don't know how to add them.
I didn't use Facebook Api in my Java application. I just give a specific URL, for example :
https://graph.facebook.com/friendID?access_token=MY_ACCESS_TOKEN_HERE
and i get a JSon Object from this URL which contains the information of that user (id, first_name,last_name,link,name,updated_time) which are not useful for what i want to do.
I also tried :
https://graph.facebook.com/friendID?access_token=MY_ACCESS_TOKEN_HERE&scope=friends_activities,friends_birthday,friends_status,friends_subscriptions,friends_work_history
but again it didn't work either to my Java App or Graph Api Explorer.
Can someone explain to me how to add the extended persmissions that i need provided that i created my app in the way i explained above? Can i add the permissions inside the URL that fetches the JSon Object?
To get a person's data, your app needs to use that person's access token. To get that person's access token, that person must authorize your app (through Facebook Login). You can read more about Facebook Login in the documentation.

How to retrieve the public information by using Facebook API?

I have a question about how to retrieve a specific person's information that is set to public by Facebook API (ex: email, location)? My idea is, (the app) to get the information that is set to public without asking the permission from the user.
I understand the Facebook Graph API could help us to retrieve the public_profile (graph.facebook.com/me), but that is very few and limited in v2.0+ (only id,name,first_name,last_name,link,gender,locale,timezone,updated_time,verified).
I also understand we can use scope in the fb:login-button (in the app) to get the user's permission to access the information. But in that case, since the user has granted it, therefore, even the information is set to private but the app can still access it, which is Not what I need.
In Graph API v1.0, we can use the API call (https://graph.facebook.com/me) to get the basic_info, which includes the information that is set to public. Since the v1.0 has already expired, therefore, I just wonder how I can get the public information by Graph API v2.0+, even other than the Graph API is fine.
Thanks.
As mentioned by #CBroe, it's not possible to retrieve such data without the user's permissions. Moreover, the info you are looking for has always been locked behind a permission even on v1.0: email and user_location
If you have a valid reason to ask for this info then explain it in your app and let the users decide.
Ref. https://developers.facebook.com/docs/facebook-login/permissions/v2.3

How to get User id by username in Facebook Graph API v2.1

we are developing a web app and were getting the user ids by using the username via FQL. Unfortunately, Graph API v2.1 does not support FQL anymore. I haven't found a way how to reference the username to find the user id in the documentation.
Is there a solution? Or is that not possible with the Graph API. I know that I can query the user ID using the name, but with the username, it would be better in our scenario.
This is intentional for privacy reasons. If you would be able to get the (real) User ID with the unique username, there would be no need to invent App Scoped ID at all.
If you make a call to /me/username, it will return the following error:
(#803) Cannot query users by their username
Btw, you cannot even get the username since v2.0, only the real name.

Facebook status updates from my own fan page

I am trying to retrieve my own facebook posts to show on my website.
Looking at SDK documentation I couldn't find it anywhere, neither with the FQL queries.
I could only find how to get the logged user statuses.
Is there a way to do what i need?
Thanks in advance.
You need to be authenticated to get access to the feed API object or stream FQL table. Both return your Facebook posts.
The easiest is to create an app, and use your app id to authenticate, then make this API call:
$result = $facebook->api('/USER_ID_OR_USERNAME/feed', 'GET');
You'll be limited to public updates. If you want more detailed updates, you will need to authenticate the person whose stream you wish to get, obtain a long-term access token and store this in your database.

Get Facebook's friends birthdays in Objective C

i found a site like graph.facebook.com but I cannot understand this API, so I wanted to know if there's a way to get the friends birthday (e.g. as an HTTP Request) ?
Please help,
Thanks in advance!
Just glancing over the documentation, it seems that you would need the user's authorization:
Look at the user api: http://developers.facebook.com/docs/reference/api/user
from http://developers.facebook.com/docs/api:
The Graph API as such allows you to easily access all public information about an object. For example, https://graph.facebook.com/btaylor (Bret Taylor) returns all the public information about Bret. For example a user's first name, last name and profile picture are publicly available.
To get additional information about a user, you must first get their permission. At a high level, you need to get an access token for the Facebook user. After you obtain the access token for the user, you can perform authorized requests on behalf of that user by including the access token in your Graph API requests
Here is an example done in FQL: Fetching friends' birthdays from facebook profile
FQL: http://developers.facebook.com/docs/reference/fql/