Facebook FQL returns <fql_query_response list = "true" / ">
I'm trying to get a facebook fql request to work using a browser, I have a valid oauth token (I can make graph api calls with it).
Here is the URL I tried:
https://api.facebook.com/method/fql.query?query=SELECT metric, value FROM insights WHERE object_id=89192912655 AND end_time=1280430050 AND period=86400 AND metric='page_fans'&access_token=? I also tried to run the fql query through the sql encoder:
https://api.facebook.com/method/fql.query?query=SELECT%20metric%2C%20value%20FROM%20insights%20WHERE%20object_id%3D89192912655%20AND%20end_time%3D1280430050%20AND%20period%3D86400%20AND%20metric%3D'page_fans'&access_token=? I tried several other indicators, I can also get metrics through the api chart, so I know that they are.
I'm sure I'm doing something dumb, but now I was at a dead end! Each call simply returns this:
<?xml version="1.0" encoding="UTF-8"?> <fql_query_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" list="true"/> Maybe my dates are a problem, I used this to get the date: (ruby)
t = Time.now => Tue Aug 03 15:00:50 -0400 2010 >> t = t - 5.days => Thu Jul 29 15:00:50 -0400 2010 >> t.to_i => 1280430050 any ideas?
Hey guys, we confirmed this error. This is because end_time must be aligned with day delimiters in PST so that the Insights table returns any data. To solve this problem, we introduced two custom functions that you can use to query a data table:
- end_time_date (): accept DATE in string form (e.g. '2010-08-01')
- period (): accept "lifetime", "day", "week" and "month"
For example, now you can query a data table using:
SELECT metric, value FROM insights WHERE object_id = YOUR_APP_ID AND metric = 'application_active_users' AND end_time = end_time_date('2010-09-01') AND period = period('day'); We will document these features soon, sorry for any inconvenience!
PS If you do not want to use the end_time_date () function, make sure that the end_time timestamp in your request is aligned with the day delimiters in PST.
Thanks!
Facebook Insights Team
The answer you see is an empty answer, which does not necessarily mean that there is no metric data available. A few ideas that might trigger this:
- Are you using a user access token? If so, does the user own the page? Is 'read_insights' extended permission allowed for user / access token? What about 'offline_access'?
- Final needs should be indicated as midnight, Pacific Time.
- Allowed periods: 86400, 604800, 2592000 (day, week, month).
- Does the query fulfill the metric 'page_fan_adds' meaningful results for a certain period?
While I was not working with the read table, working with Facebook FQL taught me not to expect error messages, error codes, but to try to follow the documentation (if any), and then experiment with it ...
As for the date, use the following ruby snippet for midnight today:
Date.new(2010,9,14).to_time.to_i I also found the following on the Graph API documentation page:
Personification
You can impersonate pages managed by your users by requesting an extended permission of "manage_pages".
Once a user grants "manage_pages" permission to your application, the "accounts" connection will provide an additional access_token property for each page administered by the current user. These access_tokens can be used to make calls on behalf of the page. Permissions granted by the user to your application will now also apply to their pages. ( source )
Have you tried to request this permission and use & metadata = 1 in your Graph API request to get an access token for each account?