Facebook GraphAPI picture/full_picture permanent link

603 views Asked by At

How can I get a permanent link for pictures in a post? For example, I can get all information about one post:

912163612218997/?fields=picture,full_picture,attachments

   {
     "picture": "https://scontent.xx.fbcdn.net/v/t1.0-0/s130x130/15390764_10154771322382505_5131571043698309499_n.jpg?oh=de4126b3944deb9fb7fca6b534e5e987&oe=58E45F29",
     "full_picture": "https://scontent.xx.fbcdn.net/v/t31.0-8/s720x720/15326300_10154771322382505_5131571043698309499_o.jpg?oh=414291d1c1fbc88988afb887177a03c5&oe=59156F5D",
     "id": "189675924467773_912163612218997",
     "attachments": {
       "data": [
         {
           "description": ...,
           "media": {
             "image": {
               "height": 372,
               "src": "https://scontent.xx.fbcdn.net/v/t31.0-8/s720x720/15326300_10154771322382505_5131571043698309499_o.jpg?oh=414291d1c1fbc88988afb887177a03c5&oe=59156F5D",
               "width": 720
             }
           },
           "target": {
             "id": "10154771322382505",
             "url": "https://www.facebook.com/photo.php?fbid=10154771322382505&set=gm.912163612218997&type=3"
           },
           "type": "photo",
           "url": "https://www.facebook.com/photo.php?fbid=10154771322382505&set=gm.912163612218997&type=3"
         }
       ]
     }
   }

However, these picture links are temporary. It won't be available after several hours.

Is there any way to get the permanent picture URL from Facebook GraphAPI?

1

There are 1 answers

0
Sung Kim On BEST ANSWER

I sort of figure out a workaround using redirect:

  1. Fire graph API using object id and get CDN URL
  2. Redirect to the CDN URL

Basically, as long as we know the object id, we can get the URL. Unfortunately, it is a bit slow.