15

I'm able to get a picture-url from a specific facebook-post through the facebook graph-api (ie https://developers.facebook.com/tools/explorer?method=GET&path=196118303833398_362048290573731), but when I need to get a picture-object (for getting bigger sized en specific crops as described in the documentation) I try

https://developers.facebook.com/tools/explorer?method=GET&path=196118303833398_362048290573731/picture

I get the response message "(#100) No node specified"... what do I forget?

user2358298
  • 163
  • 1
  • 1
  • 4

5 Answers5

39

I'm giving an example with a specific post ID 20531316728_10152364602581729. This post ID can be any post ID if the post is of type "photo".

If the post type is "photo", you can retrieve the post object ID by calling:

https://graph.facebook.com/20531316728_10152364602581729?fields=object_id

This returns an object ID 10152364594836729.

As you might see, the ID returned is the second part of the post ID, I don know for sure if this is always the case or if this will always be the case, just to be sure, it's saver to ask the object ID off of the API.

Now you can call the picture url on the object ID instead of the post ID and it will work.

https://graph.facebook.com/10152364594836729/picture

In an html img tag this will look like this:

Jimmy Knoot
  • 2,378
  • 20
  • 29
  • 5
    Doesn't work for my photo post. It returns a question mark image – Yar May 23 '14 at 13:34
  • Thanks, via {object_id}/picture I can finally access the full sized image attached to posts – Ti Hausmann Aug 02 '14 at 13:02
  • how can you make it not return the question mark image? – Stefan Aug 11 '14 at 11:40
  • some most of the object_id are redirect to, https://fbstatic-a.akamaihd.net/rsrc.php/v2/yA/r/gPCjrIGykBe.gif – Vineesh TP Oct 14 '14 at 03:55
  • The question mark image is because the actual response is a redirect to the image... – eljamz Jun 14 '16 at 17:42
  • You need to add redirect=false to your URL, and the you will GET an array of elements. After that youget this json response... get the url from there and use it. `{ "data": { "is_silhouette": false, "url": "https://scontent.xx.fbcdn.net/t31.0-0/p180x540/12377827_520168951489151_2458294024144034760_o.jpg" } }` – eljamz Jun 14 '16 at 18:24
  • It gives me a smaller image. – Ilyas karim Mar 10 '17 at 17:46
  • I',m able to get json object by using this but when i try to get image from url that time i got below. You don't have authorization to view this page. HTTP ERROR 403 My Data is {Response: responseCode: 200, graphObject: {"data":{"is_silhouette":false,"url":"https:\/\/scontent.xx.fbcdn.net\/v\/t1.0-0\/p130x130\/15823128_1410870732328880_8552833390445021381_n.jpg?oh=48d7f2fa81752524bb23d5916feb8297&oe=5A0693A9"}}, error: null} – Vishal Patoliya ツ Jul 06 '17 at 18:29
  • can you please help me to call this url using php? – Md. Abutaleb Mar 15 '18 at 11:10
26

Only users and pages have a picture connection – posts don’t. (A field is something different.)

But I guess the full_picture field is what you want: https://developers.facebook.com/tools/explorer?method=GET&path=196118303833398_362048290573731%3Ffields%3Dfull_picture%2Cpicture

CBroe
  • 91,630
  • 14
  • 92
  • 150
8

As of version 2.8 now you could access image with following URL: https://developers.facebook.com/tools/explorer?method=GET&path=196118303833398_362048290573731/attachments

heroin
  • 2,148
  • 1
  • 23
  • 32
5

You can access the post image through this (http://graph.facebook.com/{ID of object}/picture) url. You have to pass access_token for getting the object Id.

https://graph.facebook.com/{Your post ID}?fields=object_id&access_token={app_id}|{app_secret}

1

You can simply get the object_id if the post type is a photo directly on the first request to graph api by passing arguments like this

https://graph.facebook.com/$id/posts?fields=id,message,created_time,type,object_id&access_token=$accessToken

mrhll
  • 11
  • 2