获取最后一条消息的object_id

时间:2013-11-28 03:08:02

标签: facebook facebook-fql restfb

使用FQL,有没有办法获取用户发布的最后一条消息object_iduser_id已知)?  

1 个答案:

答案 0 :(得分:0)

SELECT post_id, created_time, message, 
       substr(post_id, strpos(post_id, "_") + 1, strlen(post_id))
  FROM stream 
 WHERE source_id = me() AND actor_id=me() 
 LIMIT 1

stream表格不提供object_id字段,这解释了为什么我们必须减去一些字符串(substr)来获取它。实际上,POSTID就是这样的:USERID_OBJECTID


结果:

{
  "data": [
    {
      "post_id": "1022361234_10201571234567890", 
      "created_time": 1383606736, 
      "message": "My message", 
      "anon": "10201571234567890"
    }
  ]
}

使用过的doc: