Use Facebook API to see which friends are going to an event - facebook-graph-api

If I have an access token for a Facebook user, is there a way to see which of their friends are going to an event? I'd like there to be a way to filter https://graph.facebook.com/<event_id>/attending/?access_token=<a_t> to only return friends of the user whose access_token is provided.

If you also include the friends_events permission with your token you can get the list of friends attending. I just verified in the Graph API Explorer that this permission and {event id}/attending will work like a charm.
Another way would be to use FQL, but it will be messier.

Related

Facebook Graph API getting friends

I am using the FB graph api to get a list of my friends' friends using:
https://graph.facebook.com/<id>/friends?access_token=<token>
Now the weird thing is that this works for some of my friends and does not work for some others. Could somebody tell me why this is happening and a possible fix?
In cases where it does not work, I get the following message: "Can't lookup all friends of YYYYYY. Can only lookup for the logged in user (XXXXX), or friends of the logged in user with the appropriate permission"
And I repeat, I AM ABLE to get friend lists of some of my friends using the above URL. What permissions are being mentioned here?
In new SDK of the Graph API is not possible to do that.
Take a look here.

JavaScript API call for "/me/friends" returns a response with empty list but correct summary

I do the call:
FB.api('/me/friends', function(response) { console.log(response);});
I see in the console log response as and object with empty data and correct summary:
Object { data=[0], summary={...}}
Where summary is (the number of my friends):
Object { total_count=444}
I know that friends edge call has been changed through APi v2.1. It works in Graph API explorer. I hve specified permissions for the requested operation before:
<fb:login-button scope="user_friends" onlogin="checkLoginState();">
</fb:login-button>
What am I doing wrong?
You misunderstand what the user_friends permission is for. This is taken from the docs about the user_friends permission:
user_friends
Provides access the list of friends that also use your app. These friends can be found on the friends edge on the user object.
In order for a person to show up in one person's friend list, both people must have decided to share their list of friends with your app
and not disabled that permission during login. Also both friends must have been asked for user_friends during the login process.
Review
Your app may use this permission without review from Facebook.
Common Usage
Use the list of friends to create a social experience in your app.

Corona SDK Facebook returns app_scoped_id and not my normal user_id

If I have understood it correctly Facebook made some changes so it returns app_scoped_id instead of the normal user_id.
The problem I have now is that no other function seems to work.
I receive an I id from Facebook, and it's the same each time I login, but if I use facebook.request("me/friends") the table is empty, if I use facebook.showDialog("friends") it
What do I need to do in Corona SDK to get this to work? Before I could use these functions after having setup them up in Facebook.
I read this thread explaining why this happen but it doesn't explain how to solve it in Corona SDK: Get Users App-Scoped user id in Facebook Graph API
As of Facebook API v2.0, friends list (/me/friend) returns ONLY user's friends who are already using your application. This limitation applies to all apps that are on v1.0 mode too.
If you're looking to get friends for tagging actions: https://developers.facebook.com/docs/graph-api/reference/v2.0/user/taggable_friends
If you're looking to get friends for inviting to a Facebook Game on Canvas: https://developers.facebook.com/docs/graph-api/reference/v2.0/user/invitable_friends
Cheers!

Do I really need to register an app to show a simple 'friends' list on my website?

I want to use the Facebook (Graph) API to show a list of names and pictures of friends of a facebook account (which I own). Do I really need to register my website as an app for this? Since I don't really think of my website as an app... Or can I somehow get an access token that doesn't expire since I can grant access to this list of friends myself?
Think of an app on Facebook as an API Key. Your App is how Facebook identifies who is making the call, what permissions you have, and if you are abusing the system or not.
And no, you can't get access to most Graph API data without a valid Facebook App.

Empty result when querying likes of friends

I'm trying to find out if friends of a user have liked a page or not. Unfortunately when calling https://graph.facebook.com/USER_ID/likes/PAGE_ID I get an empty array, when using the access_token of my app.
When using the access_token of the Graph API Explorer, everything seems to be fine and I'm getting the data. I've checked the permissions in my privacy settings and they both have the friends_likes permission.
Ok, it seems that users who are admins of the page don't have a like entry. Therefore you won't get a result when querying the likes of said user.