get picture object from facebook post with graph api

后端 未结 5 1195
情书的邮戳
情书的邮戳 2021-02-05 13:21

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=19611830383339

5条回答
  •  旧巷少年郎
    2021-02-05 13:51

    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:

提交回复
热议问题