How does Facebook API Rate Limit work for App Access Token? - facebook

I'm working on a project where an app displays events in the near surrounding based on the personal preferences of the user. We plan on getting the events from the Facebook Graph API using this approach. Due to Facebook's API changes it is much more complicated to search for events in a particular city. Therefore it requires much more API calls than before and i'm worried about FB rate limit.
We want to get the information about events by calling the Graph API with our app access token from our server and then store the data temporarily in our own database. So every time a user searches for events in our app, the client gets the information from our database. Moreover the user can (but don't has to) log-in with his Facebook account in order to provide us more information about him. We want to use the user's access token to call the API in order to get the user's likes.
I've read the FB documentation about the rate limits and some posts here on the site. Apparently FB calculates the number of calls based on the active users (200 calls per user every hour). It says that
"These limits apply to calls made using any access token other than a
page access token"
ergo they also apply to the app access token. Additionally in the FB policy it says something about 100M calls per day.
So my questions are:
How does the rate limit work on a per user basis if I am using my App Access Token?
To what token does the "100M" number belong? Is it an overall number for all tokens used by the app?
A similiar question has been posted here some time ago but didn't receive any answers. I hope maybe someone got new information since then. An answer to these questions is crucial to our project, so bear with me if you've read that question before.
Thanks in advance!

Please check this
Facebook Rate Limits

Related

How can I programmatically retrieve Facebook Audience Network performance data by hour?

I'm spinning my wheels over here and could use some help.
For our internal app analytics system, I have a script that currently uses the FB App Insights Reporting API to get basic Fb Audience Network ad metric data (requests, impressions, revenue, etc.):
https://developers.facebook.com/docs/graph-api/reference/v2.6/application/app_insights
It only reports data by day though (even though it misleadingly returns a Timestamp with the response), and we now have a business need to collect this data by hour, so we can accurately generate reports for any time zone.
I came across another part of the Graph API that seems built for this specific reporting purpose, and, according to the documentation, does support hourly granularity:
https://developers.facebook.com/docs/graph-api/reference/v2.6/user/adnetworkanalytics
I am moderately familiar/comfortable with FB API security and design, but for the life of me I cannot get anything but an empty data list back from this API edge. Sample request:
https://graph.facebook.com/v2.6/<user_id>/adnetworkanalytics?since=1467176400&until=1467262800&event_name=fb_ad_network_request&aggregateBy=COUNT&breakdowns[0]=country&breakdowns[1]=placement&breakdowns[2]=app&period=hourly&access_token=<user_token>
From what I can tell this means that the 'User' (me, or technically the dummy app I have set up to access Insight API data through) does not have correct permissions to access this data, and indeed when I check my permissions I do not see the associated permission, read_audience_network_insights listed.
I have tried to add the permission to the app I am accessing this through by adding the permission through the Graph API Explorer in the dialog that pops up when you select 'Get User Access Token.' However, even after adding there I still do not have the associated permission granted, even though it shows in the dialog if I go through the process again:
I think this is because I have to submit this App to FB Review for that specific permission, but when I try that, I do not see the permission available to be selected for review.
SUMMARY:
Like my title says, my goal is just to get my FB Audience Network data by hour. I'm open to any programmatic way of doing this (preferably something I can implement in a python script). If that means someone helping me get permission and successfully use the adnetworkanalytics edge that is great. If it is through other means I am not aware of yet, that is great too. Thank you!

Scraping facebook

I need to quickly get the names of about 1000 users that I now only have the facebook id and access tokens of. I'm not comfortable with the FB api yet so I was considering just writing a scraper to retrive the name from the FB page of the user (since I have the id of the users).
Is this allowed? I assume it's not "best practice" but how severe is it? Will it get me banned for instance? The data will only be used to complete our user database so no advertisement
Alternativly: Can anyone point me in to a good (and up to date) guide of how to get user info using the FB api (keep in mind that I have the ID and the access.tokens of all my users).
No, scraping is not allowed and you MUST use the Graph API: https://www.facebook.com/apps/site_scraping_tos_terms.php
/me?fields=name&access_token=[user-access-token] returns the name of a User - You may run into API limits though, but if it´s a one time thing it should not really matter. If you run into limits, just wait a bit and get the next batch.

Can I create an application which monitors a user's activity on Facebook?

I wish to create an application which me and my friends would subscribe to and which in turn can monitor a count of items in the news feed using the required permissions (kind of a social network statistics).
I read the developer documentation, but I couldn't find out if it's possible. Subscribing to my application (and allowing the permissions) is a one-time process for my friends. From then on, can my application read the fields mentioned in Graph API for the subscribed users at any time (without the user's involvement)?
You might be interested in using the Real-Time Updates API from Facebook. Using this, you will no longer have to continuously "poll" the Graph API. Rather, Facebook will send the updates to your server.
Here are some sample implementations of the API, https://github.com/facebook/real-time/tree/master/samples.
No.
Facebook used to have the "offline_access" permission which would let applications have an access token that does not expire.
Not a while ago though Facebook deprecated this permission as stated in Removal of offline_access permission.
The longest (that I'm aware of) that a token is valid for is 60 days. If you want to extend that time frame you'll have to get the user to interact with your application.

Facebook Graph API FQL Query Limit

Is there an official limit (or at least a guaranteed rate) for Graph API calls?
I am getting valid access_tokens for users and use them both on web server and client side scripts. Both calls use FQL queries, which are like below:
SELECT+page_id+FROM+page_fan+WHERE+uid=me()+and+page_id=...&access_token=...
SELECT+post_id+FROM+stream+WHERE+(privacy.value='EVERYONE'+OR+privacy.value='ALL_FRIENDS')+AND+attachment.description='...'+AND+attachment.name='...'+AND+actor_id=me()+AND+source_id=me()+AND+is_hidden=0&access_token=...
I plan to query once every minute for each access_token and some will be made from client IPs, some from web server IP. So what exactly must I care?
And one additional question :) about the "me()" in those queries, if I make the calls from client or server does it differ? e.g. if the client user changes his/her FB login out of my web page, does it refer to new login or the login that the access_token had been generated?
When Facebook had app boxes and profile pages, My Countdown app updated the profile once per hour. At one point it had 400K users, thus was making 9.6 million (400K x 24) calls to Facebook per day.
I'm not sure if there is a limit, but the subscribe feature is suppose eliminate the need to hit their API so often. It sounds like you are trying to check if anything changed. The subscribe API call essentially tells Facebook to let YOU know when something changes.
Really, your issue is going to be network bandwidth and CPU, not Facebook limits.
The me() refers to the user/page ID encoded in the access token. Lint the token at https://developers.facebook.com/tools/debug and see what id it is for.

How to simulate silent login to Facebook Graph API?

I'm working on an API that will aggregate data from several website, including facebook. The API has an engine that harvests data on regular intervals, and then the client app polls the API to get the data from all websites centrally.
The problem is that the API has no way of authenticating on the regular, behind-the-scenes harvests, as Facebook insists that the user has to click on the OAuth Dialog. With the short story being that there is no way to login to graph API silently this almost means that developing such an API is not possible (except for harvesting only public data).
However, I'm not easily satisfied by "it's not possible" answers and my clients - even less so. Accessing private information on demmand is defnitely possible as Facebook apps do that. For example, the official Twitter app posts on my wall whenever I tweet. I guess apps only need a permission once and then can access the user's profile as much as they like.
So this leads me to think that I should do a combination of a Graph API client and an application that talk to each other, and whenever the API needs to harvest - it asks the app to get the data and fetch it to the API. Or maybe it should be a push model (the app sends the data whenever it's generated) rather than pull (the API requests the data at regular intervals).
Am I on the right track? Is any of these the correct design approach?
I did some searching but it's very hard to find any useful discussion on the topic as whatever keywords I try I only find "Can I login silently? No" type of discussions.
You'll want to look into the offline_access permission. This lets you access a user's data when they don't have an active session, or are offline. That's as close to "silent login" as you can get.