13
  {
    "id": "11882030_4952296803730", 
    "from": {
      "name": "xxx", 
      "id": "11882030"
    }, 
    "message": "test", 
    "picture": "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/408410_4952294483672_298434229_s.jpg", 
    "link": "https://www.facebook.com/photo.php?fbid=4952294483672&set=pcb.4952296803730&type=1&relevant_count=2", 
    "icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yx/r/og8V99JVf8G.gif", 
    "actions": [
      {
        "name": "Comment", 
        "link": "https://www.facebook.com/11882030/posts/4952296803730"
      }, 
      {
        "name": "Like", 
        "link": "https://www.facebook.com/11882030/posts/4952296803730"
      }
    ], 
    "privacy": {
      "description": "Friends", 
      "value": "ALL_FRIENDS", 
      "friends": "", 
      "networks": "", 
      "allow": "", 
      "deny": ""
    }, 
    "place": {
      "id": "471607792876974", 
      "name": "TTT", 
      "location": {
        "street": "", 
        "zip": "", 
        "latitude": x, 
        "longitude": x
      }
    }, 
    "type": "photo", 
    "status_type": "mobile_status_update", 
    "object_id": "4952294483672",
    "application": {
      "name": "Facebook for iPhone", 
      "namespace": "fbiphone", 
      "id": "6628568379"
    }, 
    "created_time": "2013-01-17T01:29:59+0000", 
    "updated_time": "2013-01-17T01:29:59+0000", 
    "comments": {
      "count": 0
    }
  }

As above, I posted a status with two photos. I can get the first photo's thumb URL in picture and the relevant link & count information in link.

But how can I get each photo's specific URL?

Stéphane Bruckert
  • 21,706
  • 14
  • 92
  • 130
adali
  • 5,977
  • 2
  • 33
  • 40

3 Answers3

9

FQL often provides more information than Graph API. You have to use the attachment parameter of the stream FQL table to get all the attached photos.

SELECT attachment FROM stream 
 WHERE source_id = me() 
   AND post_id="11882030_4952296803730"

Result:

{
  "data": [
    {
      "attachment": {
        "media": [
          {
            "href": "https://www.facebook.com/photo.php?fbid=471082296...", 
            "alt": "", 
            "type": "photo", 
            "src": "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash3/5826...", 
            "photo": {
              "aid": "4391039135", 
              "pid": "439104482145", 
              "fbid": 471507, 
              "owner": 102832, 
              "index": 1, 
              "width": 485, 
              "height": 172, 
              "images": [
                {
                  "src": "https://fbcdn-photos-a.akamaihd.net/hph...", 
                  "width": 130, 
                  "height": 46
                }
              ]
            }
          }
        ], 
        "name": "", 
        "caption": "", 
        "description": "", 
        "properties": [
        ], 
        "icon": "https://fbstatic-a.akamaihd.net/rsrc.phpjk.gif", 
        "fb_object_type": "album", 
        "fb_object_id": "4391044992857139135"
      },
      { 
        ... //Photo 2
      }
    }
  ]
}
Stéphane Bruckert
  • 21,706
  • 14
  • 92
  • 130
  • ty very much , i'll check tommorow :) – adali Jan 17 '13 at 13:42
  • 3
    Does anyone know if this is possible now that FQL has been deprecated? – berserkia Jun 25 '14 at 00:11
  • 5
    @berserkia I think you can use graph api like this: `POSTID?fields=attachments`, this will return the same structure as you can see above. – Gaucho_9 Oct 16 '14 at 07:24
  • @iamkhush I have checked it out right now and it seems to work for me. If you try it in the Graph API Explorer, there is in the connections options. – Gaucho_9 Nov 03 '14 at 09:01
  • @Gaucho_9: I have a post with object_id 719638738118985 in the stream. I can get the details using Get call to /v2.2/719638738118985. When I try /v2.2/719638738118985?fields=attachments, the error says its a nonexistent field. How do i get the connections? – iamkhush Nov 04 '14 at 11:59
  • @iamkhush I inspect your post and I have seen that this post have an image. You can access the image object with `v2.2/719638738118985?fields=images`. There aren't attachments in this post. – Gaucho_9 Nov 05 '14 at 13:31
  • @Gaucho_9: This returns different sizes of the same image. We want all images in same post. – iamkhush Nov 05 '14 at 14:37
  • @iamkhush: Yes it's true. But when I go to post link: `https://www.facebook.com/nh7weekender/photos/a.719638488119010.1073741880.110400542376144/719638738118985/?type=1` there is only one photo, so no attachments there. I think the attachments connections is only visible when there are more than one image. Can you try it on a post with two images? – Gaucho_9 Nov 07 '14 at 11:10
3

Based on Stéphane Bruckerts answer; you're after attachments. So I'd recommend simply requesting the attachments field in your graph request.

Julian F. Weinert
  • 7,474
  • 7
  • 59
  • 107
0

Although this question is a few years old, it still comes up when searching for this topic.

Facebook (Meta) Graph API has changed. Current Facebook (Meta) Graph API is version 13.0.

The best endpoint I found was to use the "/feed" URI slug, with "fields=attachments". Simply cURL / GET:

https://graph.facebook.com/v13.0/$PAGEID/feed?access_token=$AUTHTOKEN&fields=attachments,full_picture,id,message,story

Reference: https://developers.facebook.com/docs/graph-api/reference/v13.0/page/feed