如何通过“标题”对Facebook Feed进行排序?

时间:2012-10-09 06:23:19

标签: json facebook-graph-api facebook-fql

我在Facebook页面上有这个JSON数据:

{
  "data": [
    {
      "id": "1234567890_0987654321", 
      "from": {
        "name": "My Facebook Page", 
        "category": "Personal blog", 
        "id": "1234567890"
      }, 
      "actions": [
        {
          "name": "Comment", 
          "link": "http://www.facebook.com/1234567890/posts/0987654321"
        }, 
        {
          "name": "Like", 
          "link": "http://www.facebook.com/1234567890/posts/0987654321"
        }, 
        {
          "name": "Action Name", 
          "link": "http://example.com/"
        }
      ], 
      "message": "This post discusses something about Javascript.", 
      "name": "A post about javascript.", 
      "link": "http://example.com/", 
      "caption": "JavaScript", 
      "description": "Something telling about the post.", 
      "created_time": "2012-10-09T03:35:22+0000"
    },
    {
      "id": "1234567890_0987654321", 
      "from": {
        "name": "My Facebook Page", 
        "category": "Personal blog", 
        "id": "1234567890"
      }, 
      "actions": [
        {
          "name": "Comment", 
          "link": "http://www.facebook.com/1234567890/posts/0987654321"
        }, 
        {
          "name": "Like", 
          "link": "http://www.facebook.com/1234567890/posts/0987654321"
        }, 
        {
          "name": "Action Name", 
          "link": "http://example.com/"
        }
      ], 
      "message": "This post discusses something about CSS.", 
      "name": "A post about CSS.", 
      "link": "http://example.com/", 
      "caption": "CSS", 
      "description": "Something telling about the post.", 
      "created_time": "2012-10-09T03:35:22+0000"
    }
  ]
}

无论如何,我可以用FQL做到这一点,我将只有"caption": "JavaScript"的所有帖子?我想按类别对帖子进行排序,我的关键字位于"caption"属性中。

2 个答案:

答案 0 :(得分:0)

如果您希望按订单缩短Feed,则需要使用FQL 这是其中一个样本

SELECT post_id, actor_id, target_id,description, message FROM stream WHERE source_id = me()  order by description

答案 1 :(得分:0)

感谢所有回答我问题的人。我想我已经得到了问题的答案。

我将在FQL上执行此查询以获取"caption": "Javascript"的所有帖子:

SELECT actor_id,message,attachment FROM stream WHERE source_id=1234567890 AND attachment.caption="Javascript"