我可以使用FQL获取特定日期的page_fan_adds的值。
SELECT metric, value FROM insights WHERE object_id = XXX AND
metric = "page_fan_adds" AND end_time = end_time_date("2012-07-20") AND
period = period("day")我得到了:
{"data": [
{"metric": "page_fan_adds",
"value": 1}
]}但是,使用Graph API,我可以获得一个月的数据:graph.facebook.com/XXX/insights/page_fan_adds/?since= 1340175600&until=1342767600。我得到了:
{"data": [
{"id": "XXX/insights/page_fan_adds/day",
"name": "page_fan_adds",
"period": "day",
"values": [
{"value": 4,
"end_time": "2012-06-21T07:00:00+0000"},
{"value": 2,
"end_time": "2012-07-20T07:00:00+0000"}
],
"title": "Daily New Likes",
"description": "Daily The number of new people who have liked your Page (Total Count)"}],
"paging": {
"previous": "https://graph.facebook.com/XXX/insights/page_fan_adds/?since=1337583600&until=%201340175600",
"next": "https://graph.facebook.com/XXX/insights/page_fan_adds/?since=1342767600&until=1345359600"
}
}对于page_fan_adds,period列只能为day。那么如何使用FQL获取一个月的数据呢?
发布于 2012-08-01 03:34:11
要做到这一点,看起来唯一的方法是分别查询所有日期,然后聚合它们。
SELECT metric, value FROM insights WHERE object_id=XXX AND
metric = "page_fan_adds" AND period = period("day") AND (
end_time = end_time_date("2012-07-20") OR
end_time = end_time_date("2012-07-19") OR
...
end_time = end_time_date("2012-06-21")
)尝试end_time IN会抛出错误。
发布于 2014-01-23 04:43:00
SELECT metric, value FROM insights
WHERE object_id=XXX
AND metric = "page_fan_adds"
AND period = period("day")
AND end_time in (
end_time_date("2012-07-20"),
end_time_date("2012-07-19"),
end_time_date("2012-06-21")
)https://stackoverflow.com/questions/11746864
复制相似问题