如何使用Graph API在一个页面中的一个帖子中获取所有照片?

时间:2016-10-17 02:02:50

标签: facebook facebook-graph-api

例如此图

https://graph.facebook.com/audi/posts?access_token=[ACCESS TOKEN]&fields=id,message,picture,link,name,description,type,icon,created_time,from,object_id&since=2016-10-14T17:54:17+0000&limit=1

将为您提供此结果(在使用您的访问令牌替换ACCESS TOKEN之后):

{
   "data": [
      {
         "id": "96585976469_10153772437221470",
         "message": "Take a night tour of Capitol Hill with the #AudiRS7. #AudiDuel",
         "picture": "https://scontent.xx.fbcdn.net/v/t1.0-0/s130x130/14680669_10153772435521470_6025374941796908984_n.jpg?oh=3654e74f79914c9bb0fa596ce8434c46&oe=589E82B4",
         "link": "https://www.facebook.com/audi/photos/a.101113351469.101662.96585976469/10153772435521470/?type=3",
         "name": "Photos from Audi USA's post",
         "type": "photo",
         "icon": "https://www.facebook.com/images/icons/photo.gif",
         "created_time": "2016-10-14T17:54:17+0000",
         "from": {
            "name": "Audi USA",
            "id": "96585976469"
         },
         "object_id": "10153772435521470"
      }
   ],
   "paging": {
      "previous": "https://graph.facebook.com/v2.5/96585976469/posts?fields=id,message,picture,link,name,description,type,icon,created_time,from,object_id&limit=1&since=1476467657&access_token=[ACCESS TOKEN]&__paging_token=[ACCESS TOKEN]&__previous=1",
      "next": "https://graph.facebook.com/v2.5/96585976469/posts?fields=id,message,picture,link,name,description,type,icon,created_time,from,object_id&limit=1&since=2016-10-14T17\u00253A54\u00253A17+0000&access_token=[ACCESS TOKEN]&until=1476467657&__paging_token=[ACCESS TOKEN]"
   }
}

这是帖子的链接 https://www.facebook.com/audi/posts/10153772437221470

它只给了我第一张照片,但我需要这篇文章中的所有照片

1 个答案:

答案 0 :(得分:0)

attachments是您要查找的字段。

(似乎没有正式记录,也许是因为这些汇总帖子很特殊。但Graph API Explorer建议将其作为可用字段之一。)