Facebook FQL 返回
我正在尝试使用浏览器进行 facebook fql 查询,我有一个有效的 oauth 令牌(我可以用它进行图形 api 调用)。
这是我尝试过的 url:
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=?
我还尝试首先通过 sql 编码器运行 fql 查询:
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=?
我尝试了一些其他指标,我也可以通过图形 api 获取指标,所以我知道它们在那里。
我确信我做了一些愚蠢的事情,但我已经被这个问题困扰了一段时间了!每次调用都会返回:
<?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"/>
也许我的日期有问题,我用它来获取日期:(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
有什么想法吗?
I am trying to get a facebook fql query to work using the 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 running the fql query through a sql encoder first:
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 a few other metrics, I can get the metrics via the graph api as well, so I know they are there.
Im sure im doing something dumb, but I have been stumped on this for a while now! Every call just 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我们已经确认了这个错误。这是因为 end_time 必须与 PST 中的日期分隔符对齐,以便 Insights 表返回任何数据。为了解决这个问题,我们引入了两个可用于查询见解表的自定义函数:
例如,您现在可以使用以下方式查询见解表:
我们将很快记录这些函数,对于给您带来的不便,我们深表歉意!
PS 如果您不想使用 end_time_date() 函数,请确保查询中的 end_time 时间戳与 PST 中的日期分隔符对齐。
谢谢!
Facebook 洞察团队
We have confirmed this bug. This is due to the end_time having to be aligned with day delimiters in PST in order for the Insights table to return any data. To address this issue, we introduced two custom functions you can use to query the insights table:
For example, you can now query the insights table using:
We will document about these functions soon, sorry for all the inconvenience!
P.S. If you don't want to use the end_time_date() function, please make sure the end_time timestamp in your query is aligned with day delimiters in PST.
Thanks!
Facebook Insights Team
您看到的响应是空响应,这并不一定意味着没有可用的指标数据。可能导致此问题的一些想法:
虽然我没有使用过见解表,但使用 Facebook 的 FQL 教会我不要期待错误消息、错误代码,而是尝试遵循文档(如果有),然后进行试验...
至于日期,请使用今天午夜的 ruby 代码片段如下:
我还在 Graph API 文档页面上找到了以下内容:
您是否尝试过请求此权限并在 Graph API 中使用 &metadata=1查询以获取每个帐户的访问令牌?
The response you're seeing is an empty response which doesn't necessarily mean there's no metric data available. A few ideas what might cause this:
While I haven't worked with the insights table, working with Facebook's FQL taught me not to expect error messages, error codes but try to follow the documentation (if available) and then experiment with it...
As for the date, use the following ruby snippet for midnight, today:
I also found the following on the Graph API documentation page:
Have you tried requesting this permission and use &metadata=1 in a Graph API query to get the access token for each account?
如果您想知道 Facebook 页面的粉丝数量,请使用类似以下内容:
响应包含
fan_count
属性。If you want to know the number of fans a facebook page has, use something like:
The response contains a
fan_count
property.我不确定日期是否正确。你真的想要将日期作为整数吗?
通常 SQL 采用 db 格式的日期,因此要格式化它,您可以使用:
I'm not sure the date is correct. do you really want the date as an integer?
Usually SQL takes dates in db-format, so to format it you'd use:
如果像我一样,您从另一个 FQL 语句获取此信息后来到这里,那么您的问题不包括 access_token 参数,例如
https://api.facebook.com/method/fql.query?query=SELECT+name+ FROM+user+WHERE+uid+%3D+me()&access_token=...
(可以使用fb.getAccessToken())
If, like me, you came here after getting this from another FQL statement, then your problem is not including the access_token parameter, e.g.
https://api.facebook.com/method/fql.query?query=SELECT+name+FROM+user+WHERE+uid+%3D+me()&access_token=...
(You can use fb.getAccessToken())