I'm working on a WordPress blog and am trying to show the total_count from Facebook FQL for the URL of each post. So when I go into a post, I grab the URL generated by WordPress, and then run the following FQL:
$fqlQuery = "https://api.facebook.com/method/fql.query?query=select%20like_count,%20share_count,%20total_count%20from%20link_stat%20where%20url=%22" . $url . "%22&format=json";
Just moved to the live server today, and this FQL is now returning the following in the JSON:
["error_code"]=> int(4) ["error_msg"]=> string(33) "Application request limit reached"
What is the request limit? How is that number determined? For instance, if I run that same FQL on my development box, I have no trouble at all. Our dev server, no issues.
Quote from here: Facebook Application Request limit reached
There is a limit, but it's pretty high, it should be difficult to hit unless they're using the same access tokens for all calls and not caching results, etc. It's 600 calls per 600 seconds per access token.
Actually, for your case, this is not an Application Request limit.
As soon as a request is performed on server-side, facebook needs an ACCESS TOKEN within your URL requests (as a parameter).
This avoids bot massive requests.
If the ACCESS TOKEN is not provided, facebook servers will deny your request with the error you talked about (33 or 4, which is the Application Request limit).
To get your ACCESS TOKEN (so your key), you just have to connect to facebook with your account, which must be declared as a developper account.
Then, go to the API explorer, where you'll get your ACCESS TOKEN.
From the API explorer, you'll be able to elaborate the requests you want, which will work well triggered from your live server.
Related
I am having an issue with Facebooks Graph API Rate limiting and saying that the
Application request limit reached
which then prevents other users from making request, even though I have generated User Access Tokens. I know they are user access tokens because when I put them into the Access Token Debugger the Type comes back as User and according to the documentation about user access tokens.
Graph API requests made with a user access token are counted against
that user’s call count.
so it should have nothing to do with any application usage but it still seems to. Nothing should be being done on the "applications" behalf I always want the user as to not block other users in-case one user is more active than others.
The user signs in on a website and a server sends the authentication token to clients who then periodically pulls content (every 15 mins). When the rate limit is reached all users appear to get the rate limit error.
Am I misunderstanding what the docs are saying about the User Tokens? Can you not have rates based on individual users and not an entire application?
When trying to create app requests through facbeook http graph api I'm getting the error "(#2) Failed to create any app request".
As described in the documentation (https://developers.facebook.com/docs/graph-api/reference/user/apprequests/) I'm using the URL https://graph.facebook.com/{userid}/apprequests setting in post the access token, a title and a message. I've tried different combinations of parameters just to check if I needed anything else, but just if I remove access token and/or title I get different errors.
In addition to that, if I use my own userid, instead of other userid (obviously a friend) that I want to send the request to, there's no error at all, but no request is created.
I don't think it may be related with permissions because both users (source and destination of the request) are admin, developer or tester of the app.
Thank you
Just in case anyone needs it, the problem is that user apprequests can only be created if using any facebook ui methods. That's why in this thread Apprequest of Android Facebook sdk 3.0 comment 1 advices to use webdialog instead of sending the request in code.
More on this topic, I've been researching and I found out that I started with my app really long ago (using API lower than 2.3) so I didn't need to set the category as "game" to be able to send apprequests. I updated its category and after multiple tests I've found the following scenarios:
Javascript API works correctly to send requests in my app
Graph API fails to send requests if using user auth token getting the same error as before
Graph API is able to send requests if using app auth token (from app_id + app_secret)
As far as I've read, there's no limitation in using either kind of auth tokens for apprequest calls.
In addition, my app will be running in web, desktop and mobile. The scenario in which I'm using graph API directly is desktop for obvious reasons (there's other APIs tor the other platforms). As recommended in the FB api documentation, the app secret should not be included in binary code deployed to users, so I would need to use the user auth token.
Any help would be apreciated
Thanks
I've searched stackoverflow all day long to find an answer without luck, so here we go.
I'm trying to fetch data from the stream table like this:
FQL: SELECT post_id, message, created_time FROM stream WHERE source_id = 131559313586863
URL: https://graph.facebook.com/fql?q=SELECT+post_id%2C+message%2C+created_time+FROM+stream+WHERE+source_id+%3D+131559313586863&access_token=10669xxxxx74470|PF-7GSdBx0Nxxxxxkdi1KwSQG-w
But I get a 400 Bad Request as response with the error message: "An access token is required to request this resource.".
I'm fetching an application access token with this url: https://graph.facebook.com/oauth/access_token?client_id=FACEBOOK_APP_ID&client_secret=FACEBOOK_APP_SECRET&grant_type=client_credentials
Facebook state in this blog post that "You will need to pass a valid app or user access token to access this functionality.". Functionality refers to /feed and /posts (the stream table). Futhermore this wiki tells the same story about using the stream table, "From June 3 2011 a token is required to query this table. You can use any application or user token to make the query.".
Does anyone see my hopefully obvious flaw?
Please note:
The profile in the FQL query is public.
I need this to run userless though a cronjob. No user interaction is possible.
The request works if I replace the app access token with my own user token from https://developers.facebook.com/tools/explorer
Are you sure your app isn't set as 'desktop/native' in the app settings? if so, the app access token can't be used
Works fine for me – once I put in a valid access token and use HTTPS.
I am developing a backoffice server application wich is supposed to email our customers with ads campaign statitistics, where camapaigns are bundled from various providers, one of them being Facebook.
Now the problem is how to download specific ads campaigns from Facebook. Basically what I need is a table for specific campaign with values for impressions and clicks for each day from requested range.
One problem is that the application is background server process, running periodically without user interactions, so I suspect there could be a problem with authentication.
From what I have read so far, I believe I am supposed to
register my application on facebook
apply for Ads API access (?)
use either legacy REST API to get statistics, or perhaps adsstatistics from graph api (but I believe that the format there is not divided for particular days).
How am I supposed to authenticate in this case?
Any suggestion as to what is the right solution here?
(Note: In the past, I was doing similiar for Google, where I have successfully used http://code.google.com/intl/cs/apis/adwords/docs/guides/reporting.html - this is just for reference about what I need to achieve).
See this page for authentication once you have Ads API access:
http://developers.facebook.com/docs/authentication/
In the end you'll need an access_token which is specific to your application and the Facebook account you are accessing.
Here's our process:
Log into Facebook account that contains the ads data
Paste this into that browser's address bar:
https://www.facebook.com/dialog/oauth?client_id={your_application_id}&scope=ads_management,offline_access,read_insights&redirect_uri={your
website}
You should be taken to a page that allows you to
authorize your application for that Facebook account (green
Allow button)
Copy the authorization code that appears after code= in the redirected url
Paste this into that browser's address bar (you may not have a client_secret with your application, if you don't try this without the client_secret):
https://graph.facebook.com/oauth/access_token?client_id={your_application_id}&redirect_uri={your website}&client_secret={your application secret}&code={code you got
from step 4}
You should be taken to a page containing the access_token
I do not think you need to store the Authorization code since the access_token shouldn't expire (if you requested offline_access) unless the log in info is changed for the Facebook Account.
Stats Retrieval
For stats retrieval, I would not use legacy REST API since Facebook will depreciate it. Graph API does allow stats retrieval by day, use:
GET https://graph.facebook.com/stats/{starttime}/{endtime}/stats?ids={campaign_id}&access_token=...
starttime and endtime can be in YYYY-MM-DD HH:MM:SS format or as a unix (epoch?) time
I'm running into "rate limit exceeded" issues on my app. I want to get a feed:
http://twitter.com/status/user_timeline/bbcnews.json
But it tells me that the rate limit is exceeded. I assume this means for all users of the app combined. How would I authenticate my twitter app (which I have set up with twitter) before requesting this feed, or incorporate the authentication in the feed request?
Per twitter's documentation:
"Unauthenticated calls are permitted 150 requests per hour. Unauthenticated calls are measured against the public facing IP of the server or device making the request."
So, for a mobile device, this limit would be at a per device basis, not overall.
If you would like an authenticated call, you will have to let user user go through oauth authentication and store the token on the device for subsequent calls. There are various sample projects on github & the rest of the web that would help you down this road.