Getting Facebook user's privacy settings via Facebook API - facebook-fql

I'm writing a javascript application to get Facebook user's privacy settings.
Can I get them from privacy-setting table and is there any fql reference on the topic?

I'm pretty sure that what you want to do is impossible with FQL. The only privacy-related FQL tables (namely http://developers.facebook.com/docs/reference/fql/privacy/ and http://developers.facebook.com/docs/reference/fql/privacy_setting/) respectively contain information about the visibility settings of objects (like photos or posts) and the privacy settings a user has chosen with regards to the querying app. Meanwhile the users table (see http://developers.facebook.com/docs/reference/fql/user/) contains nothing privacy-related.
The Graph API similarly does not provide any means to access the information you want. The user object (see http://developers.facebook.com/docs/reference/api/user/) allows you to access all the same privacy-related information as FQL, but does not let you access the user's privacy settings.
Are you sure you really need to get the user's privacy settings? I'm not entirely familiar with this stuff, but I'm pretty sure that:
If you are concerned about whether posts your app makes on the user's timeline will be public, that is covered entirely by the information you can pull out of the privacy_setting table.
If you're going to be using extended permissions to post on the user's behalf via the graph API, then you get to explicitly specify the privacy settings of the objects you create anyway.
Perhaps I just lack imagination, but I can't think of any scenario in which knowing a user's privacy settings would be useful, given that for basically any object you post as a user you can specify to whom it will be visible and thereby override your privacy settings. What is your use case?
If you don't need to be 100% certain, you could always just pull the privacy settings of objects they've posted previously and see what the most common setting is, and then guess from that what their defaults are.

Related

Storing Facebook Data

I know there have been numerous questions regarding Facebook's policies in which we can store information into our application's database. I have looked at Storing Facebook API data and also have looked at https://developers.facebook.com/policy/ but I just want to ensure that I am not violating Facebook's terms of use. I want to store a user's objectID in order to get certain information about them for use on another screen on my application (namely their profile picture) into my database. I was wondering, is that considered okay? I have looked around and haven't seen anything explicitly speaking about storing a user's objectID so I just wanted to confirm this would be okay. If this is not okay, would any one have any suggestions on how I can get a specific user's profile picture? Thanks!
I believe for Facebook's API things like a user's object ID is actually just an ID for that user for specifically your application. Meaning, you have a unique ID for a user that is completely different than the ID that Facebook uses internally or that another application has for the same user. So unless I terribly misunderstand, you can and should store that.

Getting a permission to see information for all the users in Facebook

When I use the search box in Facebook and try to find a user, it shows me a list of all the matching users while I'm typing, along with additional information on them, such as the city they live in, and when I enter their wall/timeline, I can see more information. However, when I use Facebook Graph API to search for users, I get only basic information, and must have a permission for each user in the results to get more. Why is that? Is there a way to be able to see more information for all the users without having a permission for each of them?
[…] and when I enter their wall/timeline, I can see more information.
Only if they have the visibility of their profile to public, though. Otherwise, you won’t see much on a user’s profile if you are not friends with them.
However, when I use Facebook Graph API to search for users, I get only basic information, and must have a permission for each user in the results to get more.
Why is that?
Because, naturally, you as a normal user browsing through a couple of search results on Facebook is something completely different than offering an app the capability to access all that information for every Facebook user from ID 1 to 99999999999, and then build some huge data mining thing upon it … I think that should be quite obvious.

Mapping permissions to information

Is there a way to access the fields that each permission is mapped to from Facebook in a programmatic way?
Say I have a list of User connections which I want to cache (i.e. links, notes, feed, and games). I also want to get real-time updates to let me know if the read_stream permissions have changed, and invalidate the cache if app doesn't have read_stream permissions anymore. I could build a map, based on the documentation, that would tell me that read_stream affects links, notes, and feed. If in the future the facebook documenation changes to also include games in the read_stream feed, my application would be caching data for games without authorization if the read_stream was not valid, and I would have to modify that map to account for this.
Is there a way to, on the fly, obtain the maps that relate each permission to each field?
I don't believe there is a way to do this programmatically. For the most part, it's fairly well documented on their site. Maybe you could make a database version of this. Just be aware, Facebook is quick to change things and maintaining will become a chore. Happy Coding!

Graph API end point to get the new "per-app post privacy" controls

A facebook user can now specify post privacy on per-application basis. This is explained by facebook on their blog.
In my web application I let people specify privacy settings while posting to their news feed. If a user has specified rather restrictive privacy than the one with he is posting to, facebook will enforce the restrictive settings as specified by user.
This results in bad user experience. I want to know if there is a way, preferably a Graph API end point, that lets me know this setting for a user. If I could fetch this information from Facebook, I could show a proper alert message, 'that to use a rather less restrictive privacy settings, (s)he will have to change his/her application specific privacy settings'. Or I could show only more restrictive privacy settings to the user while posting something in my UI.
Any pointer to where Facebook has documented this new feature from developer point of view in details is also appreciated.
I believe the privacy_setting table (available via FQL) provides what you're looking for.
https://developers.facebook.com/docs/reference/fql/privacy_setting/
*An FQL table that returns the default privacy settings that a user has set for an app.
To read the privacy table you need the following permissions:
User access_token
The data returned is for the user and the application associated with the given access token.
Example
Select the default settings you have set for this app (try this query for a test application):
SELECT name, value, description, allow, deny, networks, friends
FROM privacy_setting
WHERE name = 'default_stream_privacy'*

Facebook extended permissions and interested_in property

Which Facebook extended permissions makes the interested_in property of friends show up?
I've tried using friends_about_me, friends_relationship_details, and friends_relationships.
Which one is interested_in located? I'm using the Facebook SDK for iOS devices by the way.
If not enough are found, is it because I'm doing something wrong or is it the individual users' settings are set up that way? On the Facebook profile page it might show Interested In: Women while the Graph API query might not show it even with the above extended permissions granted.
Also when I try it with a query string ID?fields=interested_in, I get nulls, except for a couple.
The permission is "friends_relationship_details". The query you are showing above is actually correct. The one thing you are forgetting is that ultimately each use can set what data their friends can share about them. The default settings for which information friends can share does NOT allow friends to grant an application access to "interested in and looking for" and "religions and political views". So in short, your query is correct and you are getting all the information you are allowed to access.
Most Facebook users have not changed these settings, meaning that only the users that have explicitly allowed friends to share interested in information will show up in your query. This will be almost nobody which is why you only have one result in your query.
To see what I am talking about go to: http://www.facebook.com/settings/?tab=privacy, click the "Edit your settings for using applications, games and websites." link, then click "Edit Settings" in the "Info accessible through your friends" section. Here you will see what permissions you allow your friends to share. There is no override for this. If you don't want the information shared, your friends can't force you to share it.
Sorry for the bad news.