14

Facebook Graph API allows getting Facebook objects like posts, videos etc in JSON from. Here is an example of a post: (taken from the documentation):

{
         "id": "719323658_129694190395214",
         "from": {
            "name": "Rabia Yalcinkaya",
            "id": "719323658"
         },
         "message": "COK MUHTESEM!!!",
         "picture": "http://external.ak.fbcdn.net/safe_image.php?d=41762b7121ee68754ebea48dee4568aa&w=130&h=130&url=http%3A%2F%2Fats.vimeo.com%2F192%2F882%2F19288238_200.jpg",
         "link": "http://vimeo.com/5646785",
         "source": "http://vimeo.com/moogaloop.swf?clip_id=5646785",
         "name": "Watermelon carving",
         "caption": "vimeo.com",
         "description": "Me carving a watermelon.",
         "icon": "http://static.ak.fbcdn.net/rsrc.php/z9XZ8/hash/976ulj6z.gif",
         "type": "video",
         "created_time": "2010-06-23T10:58:17+0000",
         "updated_time": "2010-06-23T10:58:17+0000",
         "likes": 1
      },

How does one construct a url which allows you to link back to the original video (or other types) on Bret's wall on Facebook? something in the form of

http://www.facebook.com/<USER_ID>/video/<VIDEO_ID>

Thanks, Boaz

Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140
Boaz
  • 25,331
  • 21
  • 69
  • 77

1 Answers1

25

in the actions field there is the link field (for each available action) which happens to contain the permalink to the given post. However be sure to inspect this before relying on it - it might change. I've only used it with "comment" and "like".

Apart from that you'd have to construct it manually. For users that have their username set (i.e. their profile is accessible via facebook.com/username, it works with:

 http://facebook.com/USERID/posts/POSTID

For everything else:

 http://www.facebook.com/permalink.php?id=USERID&v=wall&story_fbid=POSTID

Source: http://forum.developers.facebook.net/viewtopic.php?pid=316384

Note that the POSTID is in the form USERID_POSTID, so you'd have to strip the first part.

Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140
  • 2
    I'm not sure if the syntax has changed since, but you can also link to the post in the same way, even if a username is not set. `http://facebook.com/PAGEID/posts/POSTID` – Matt Apr 19 '13 at 09:02
  • 9
    The irony in the fact that the "forum" link doesn't work anymore is not lost on me. – Andrew Theken May 10 '13 at 14:37