Facebook API: Get Shared Post ID

前端 未结 1 1285
花落未央
花落未央 2021-01-02 02:02

Using FB Graph API, is it possible to check if the post is shared like this one? https://www.facebook.com/alexey.kosov/posts/10203624447732200

And how to get the ori

相关标签:
1条回答
  • 2021-01-02 02:22

    In your URL https://www.facebook.com/alexey.kosov/posts/10203624447732200 the 10203624447732200 is your public post id. With the API v2.0 you can get the shared posts with the edge sharedposts: https://developers.facebook.com/docs/graph-api/reference/v2.0/object/sharedposts

    According to the documentation on v2.0:

    For page posts, public posts by the page are retrievable with any valid access token. Posts by people on the page, posts by people which mention the page, or targeted page posts (by language or geography, for example) may require a user or page token. A user access token with read_stream or user_posts permission for any other posts

    So you need a token with one of the two permissions.

    I tried to retrieve the share from your post: https://developers.facebook.com/tools/explorer/?method=GET&path=10203624447732200%2Fsharedposts&version=v2.0

    And it returned me {"data": []}, however after I shared the post, I repeated the call and I was able to see the post that I just shared in the results.

    Now, if I use the post_id that I just shared, I receive again an empty result. So you can see only see who shared the post but not if it was shared from somebody else. If you think of shared posts as nodes of a tree, you can only see what happens on the subtree under the node with the post_id that you have.

    You also need to consider that you will not be able to retrieve the re-shared posts that are not visible to you. i.e.: if I share your post with privacy "Only me" or if I share it with privacy "Friends" and we are not friends you will not be able to see it.

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