How to construct a permalink for objects returned by Facebook's new Graph API?

后端 未结 1 878
遇见更好的自我
遇见更好的自我 2020-12-14 10:19

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):

{
              


        
相关标签:
1条回答
  • 2020-12-14 11:14

    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.

    0 讨论(0)
提交回复
热议问题