【发布时间】:2012-01-21 16:21:28
【问题描述】:
我无法弄清楚 end_date 和 period 参数 (?) 的含义以及对 page_impressions 指标(不带参数)的 API 调用结果。
我查询上周的page_impressions。响应包含时间段“week”(即第二个数组),还包含 3 个嵌套数组,其中包含不同的 end_time。这个结束时间让我很困惑。
这应该如何解释?我应该使用 PHP SDK 的 api() 方法来控制这些参数吗?
这是一个示例响应:
array
'id' => string '194501267300320/insights/page_impressions/day' (length=45)
'name' => string 'page_impressions' (length=16)
'period' => string 'day' (length=3)
'values' =>
array
0 =>
array
'value' => int 1473
'end_time' => string '2012-01-17T08:00:00+0000' (length=24)
1 =>
array
'value' => int 1100
'end_time' => string '2012-01-18T08:00:00+0000' (length=24)
2 =>
array
'value' => int 1194
'end_time' => string '2012-01-19T08:00:00+0000' (length=24)
'title' => string 'Daily Total Impressions' (length=23)
'description' => string 'Daily The number of impressions seen of any content
associated with your Page. (Total Count)' (length=92)
array
'id' => string '194501267300320/insights/page_impressions/week' (length=46)
'name' => string 'page_impressions' (length=16)
'period' => string 'week' (length=4)
'values' =>
array
0 =>
array
'value' => int 12762
'end_time' => string '2012-01-17T08:00:00+0000' (length=24)
1 =>
array
'value' => int 11943
'end_time' => string '2012-01-18T08:00:00+0000' (length=24)
2 =>
array
'value' => int 12280
'end_time' => string '2012-01-19T08:00:00+0000' (length=24)
'title' => string 'Weekly Total Impressions' (length=24)
'description' => string 'Weekly The number of impressions seen of any content
associated with your Page. (Total Count)' (length=93)
Facebook 开发者页面上提到了 period:
收集指标的时间长度, 以秒为单位表示为 86400(天)、604800(周)、2592000 之一 (month) 或 0 (lifetime) 或使用函数 period() 取一 字符串中的日、周、月或生命周期。
注意:每个指标可能没有所有可用的时间段。
和end_time:
收集指标的时期结束, 表示为 unix 时间(应始终为午夜,太平洋 夏令时)或使用函数 end_time_date() 'YYYY-MM-DD' 格式的日期字符串。
【问题讨论】:
标签: php facebook facebook-graph-api