我一直试图获取Facebook页面的历史数据。我想知道如何确定我能走多远。
所以我知道我可以回去一个月。这是一扇滚动的窗户吗?我也想知道我可以回到多远,并没有得到如下的api异常。
{
"error": {
"message": "Unsupported operation",
"type": "FacebookApiException",
"code": 100
}
}
是否可以获取我有权访问的给定粉丝页面的所有历史洞察数据。
谢谢,并且欢迎任何可能有助于理解如何干净利落地做到这一点的建议。
答案 0 :(得分:1)
从当天结束的30天开始,例如
/278905338821044/insights/page_fans/lifetime?since=30 days ago&until=now
响应将包含最近30天的数据,您可以迭代地浏览最后paging
结构中的“之前”链接以返回过去
{
"data": [
{
"id": "278905338821044/insights/page_fans/lifetime",
"name": "page_fans",
"period": "lifetime",
"values": [
{
"value": 1432,
"end_time": "2012-09-19T07:00:00+0000"
},
//snip
{
"value": 1438,
"end_time": "2012-10-16T07:00:00+0000"
}
],
"title": "Lifetime Total Likes",
"description": "Lifetime The total number of people who have liked your Page. (Unique Users)"
}
],
"paging": {
"previous": "https://graph.facebook.com/278905338821044/insights/page_fans/lifetime?since=1345405748&until=1347997748",
"next": "https://graph.facebook.com/278905338821044/insights/page_fans/lifetime?since=1350589748&until=1353181748"
}
}