Get all Facebook friends in one Request - facebook-graph-api

I would like to retrieve all of a user's facebook friends with the installed field for my app. With facebook's graph api, it paginates the response, but I don't want to have to make multiple requests per user. Is there a way to do https://graph.facebook.com/<user_id>/friends?fields=installed&access_token=<access_token> to get all friends and not paginated?
If you are wondering, I am using this data to reconstruct a friend graph for my application.

You can add limit to the call to increase the number of results you get. E.g.:
https://graph.facebook.com/<user_id>/friends?fields=installed&access_token=<access_token>&limit=1000

Related

Posting event to facebook using the graph api

I am trying to build an application where admin users would trough a form insert "events" containing title, description, starttime/endtime and some other fields. At the moment theese users are primarily using facebook to reach out to their users, they would like to be able to move to my app aswell as stay on facebook without too much hassle. I solved the issue of getting the events of facebook by having them all sign up for the graph api with their community/company pages and giving me the access token to fetch data about their events trough a get request to.
https://graph.facebook.com/v15.0/me/events?access_token={their token}
Now my next task at hand was simple i tought simply make a post request to the same api endpoint, but i quickly realized i was not able to do this and well i do not know how to proceed to be fair.
Tried to make a post to the same endpoint but got errors and after searching the documentation found that this was not supported??

How to get Facebook page posts count on Android using Facebook SDK

I am building an app, which lists all posts from a Page(that I manage and post to) and also gets corresponding posts view count. I looked into the documentation and it seems like the page needs a minimum of 30 Likes for insights API to work. Is this correct? Is there a way I can get the view count?
Here is the output from Graph Explorer. I have set the access token to Page Access token.
I am passing the Post_ID to HTTP GET. I can see directly from Facebook that the post has reached N number of people. But the returned data from the API call is empty. Any help?

facebook graph api webhook friend not working

I am trying to keep track of my users' facebook friends. I thought that using the webhook is the best solution to this problem.
The webhook is currently working, the request I get from facebook is a json of 2 objects (users), who added each other as friends, so I am able to update them in the database.
For some reason I sometimes get an object of only one user, and I get the other friend in a seperate object. There is no way for me to relate the 2 requests together.
I have read through the whole document but it didn't help https://developers.facebook.com/docs/graph-api/webhooks/v2.5
Is there something that I am doing wrong, or is just using the webhooks for this task is not the right solution? If it's not the solution, should I scrape all my user's facebook friends periodically?

Facebook graph api response taking time

My app is using the Facebook Graph API to retrieve the complete list of a Facebook user's friends:
GET https://graph.facebook.com/USER_ID/friends?limit=5000&access_token=ACCESS_TOKEN
Results are taking a long time to show up. What could be the error? Is there an alternate way to fetch the results at a faster pace?
thanks.

Using Django with the Facebook API for a polling app

I randomly pick two friends of the user and ask him/her to pick who is the better friend. Now all I have is the friend ID which I then have to use to create a poll and store in the database accordingly. Using the Facebook graph API, I have the ID. All I need to do now is to pass it to Django.
I'm new to this so how exactly would I do that? Pass a javascript variable to Django?
I see two options.
At client side using Javascript SDK,
Fetch the friends' profile details along with ID.
Convert them to JSON.
Do a POST request to a django url/view which stores the data in database.
In this way, you don't need to do any graph API queries further from server side. But this won't help you updating the data at realtime. Consider, if one of the friends changing his name in FB, now what is stored in your database becomes obsolete. So, you need to make sure that some thing from client side implemented to do real time update posts to server side.
At server side using any django facebook graph API apps,
Get the IDs from client side.
Use the fb graph app to fetch the details at server side.
Store them in database.
In this way, you could be able to schedule a callback for real time updates. I prefer the second approach as it's always better to burden the server rather than client. And I found this app simple and do what you need. https://pypi.python.org/pypi/django-facebook-api/0.1.10