Facebook api: get users by work - facebook

Is it possible to get all Facebook users by work ID? I tried to find it via google but I'm getting the results I need.
I have the 'work ID' (which is infact a page, right?), but now I need all users that work there..

No, there isn't a way to get all users by work directly from FB. You can query the user table to get a particular user's work history but the converse isn't possible. Perhaps LinkedIn offers that kind of data ? But Facebook doesn't AFAIK.

Related

Interact with Facebook data

I would like to know if there is a way to extract some informations from facebook users and pages without creating a facebook app.
In other words, I would like to know if it is possible to do on facebook what can be done on Twitter using their streaming API (facebook is more suitable for my purposes), or if is there a dataset that I can query without having to interact with every single user to get his/her permission (without using access tokens).
To be more specific, I need to know two kind of infos from users: the place where they live and their likes on page and nothing more, users can be anonymous or with a fake ID or whatever.
Thank you!
For privacy reasons, it is not possible at all. You must authorize a user with the correct permissions to get that kind of data.
Also, you would not be allowed to use the data in any way without asking the user for permission, and scraping is not allowed on Facebook. Even if it would be possible without the Graph API, it would not be allowed.

using the facebook graph to display profile pictures ...what if someone changes their username?

I am building a web app that will retrieve basic Facebook user information, among them also the profile photo, via
https://graph.facebook.com/USERNAME/picture?width=100&height=100
I plan on storing that variable in my database so that I can display the profile photos in the web app.
Now, I'm wondering what happens when someone changes their Facebook username from "jimmysmith" to "jamesdoe", for example? I assume that my saved URL of
https://graph.facebook.com/JIMMYSMITH/picture?width=100&height=100
will stop working? Is there any way around this?
Or will it still work because Facebook redirects the old username to the new username, maybe? I found no evidence of that, however. I have no way of testing it, either.
The way I retrieve it via FQL is:
$fql = "select uid, name, email, birthday from user wher.... etc.
Use the user IDs instead.
Usernames will not be query-able in v2.0 API.
See https://developers.facebook.com/docs/apps/upgrading for more information.

How to get public Facebook Page data no matter the country/language admin selected?

As you may know, Facebook Page Administrators can select for posts to be visible to only certain countries/langauges ( https://www.facebook.com/note.php?note_id=180817924821 ).
However, I would like to use the Graph API to retrieve feed messages ( /feed ) for ALL countries/languages or be able to select data for a specific country.
For example:
1) I would like to get ALL posts (and comments ...) from all of Starbucks Facebook Page. So no matter what the administrator says, just ALL.
2) I would like to be able to retrieve only the posts that are visible to users in Germany.
Are both these example actually possible? Probably, because I use access_tokens Facebook will probably use my own country/langauge to decide what data I get so that would mean I would have to change country all the time which is of course not an option to ask my users.
Any of you know what to do?
This is only possible if you're using the app as an admin of the posting page.
As you mentioned, the API will detect the user behind your access_token and only display posts that would normally be accessible to them on the desktop site.
This is an intentional restriction, so there's no way around it.

Get users Facebook ID for database

I need the following, any help would be much appreciated.
I Have a registration form.
It inputs the data Name | ID | DOB | TWITTER | FBID
When the user registers it asks for the above values.
Twitter is easy as users can just put in their Twitter ID.
But I Need to get the users Facebook ID in the form.
What would be the best way to do this?
Could i use the 'Connect To Facebook" Feature.
All i need is the Facebook user ID so that i can use it when retiring graph data later on.
I have set up a Facebook Application and am using PHP with a MySQL database.
Thanks
Alex
Well, they have specific APIs for different functions. In your case none of their simple solutions work. You will probably need to use Facebook's Graph API. You should take a look in their PHP SDK. It is a very useful tool. I used it once and it worked perfectly.
You will need to know much, before you get the users is. Also if you want to make that automatically, they will have to be logged in and they will have to confirm access to their personal data from your facebook app.
Good luck!
For any user data you wll need to get permission from user.
You can use Facebook connect.
Make the user log in and get access token, this access token is the key to all user data.
You can use this access token with graph API also.
Check my blog.

How would I get a list of 'friends' who have added my Facebook application?

I'm really struggling with something that should be a simple matter: Showing a user of my Facebook app a list of their friends also using the app. Is there nothing built into the APIs to allow such a common request?
The only thing I can think of to do is to get the list of the user's friends, and then get all the users from my database who are in that list, and then fetch information for each of those facebook ids. But that seems an extremely roundabout way of doing things...
The only way I've found to do this is to use FQL and a previously documented, but now undocumented field:
SELECT uid,name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=<user's uid>) AND is_app_user=1 ORDER BY name
The undocumented field is the user.is_app_user, which is listed in the old documentation wiki but not in the shiny new docs. No idea if this means it'll be removed in the future, but there doesn't seem to be any other way to get this data with the new Graph API.
Just in-case you're still using the old REST API, you can also call the friends.getAppUsers method.
You can actually use Facebook's old REST API to do this by sending a GET request to: https://api.facebook.com/method/friends.getAppUsers
If you need JSON data back, then add the parameter format=json
You need an access token to do this. See the documentation here:
http://developers.facebook.com/docs/reference/rest/friends.getAppUsers/