Facebook Application: Uploading multiple images in one post to wall

后端 未结 3 1587
[愿得一人]
[愿得一人] 2020-12-15 15:24

How to upload multiple images in one post via api?

Like here: http://www.facebook.com/SocialCity?v=wall

I have managed to upload only one image via curl requ

相关标签:
3条回答
  • 2020-12-15 15:31

    You can now publish multiple images in a single post to your feed or page:

    For each photo in the story, upload it unpublished using the {user-id}/photos endpoint with the argument published=false

    curl -i -X POST \
     -d "url=https%3A%2F%2Fwww.facebook.com%2Fimages%2Ffb_icon_325x325.png" \
     -d "caption=test%20photo%20upload" \
     -d "published=false" \
     -d "access_token=<user_photos_token>" \
     "https://graph.facebook.com/v2.6/me/photos"
    

    You'll get an ID for each photo you upload like this:

    {
      "id": "10153677042736789"
    }
    

    Publish a multi-photo story using the {user-id}/feed endpoint and using the ids returned by uploading a photo

    curl -i -X POST \
     -d "message=Testing%20multi-photo%20post!" \
     -d "attached_media%5B0%5D=%7B%22media_fbid%22%3A%221002088839996%22%7D" \
     -d "attached_media%5B1%5D=%7B%22media_fbid%22%3A%221002088840149%22%7D" \
     -d "access_token=<publish_actions_token>" \
     "https://graph.facebook.com/v2.6/me/feed"
    

    Source: Publishing a multi-photo story

    0 讨论(0)
  • 2020-12-15 15:39

    It's possible by now with the Open Graph however it seems to apply only to user generated fotos: https://developers.facebook.com/docs/opengraph/usergeneratedphotos/

    0 讨论(0)
  • 2020-12-15 15:52

    Multiple photo upload via one Graph API call is not supported. However you can create individual api calls and batch those in one request described here: https://developers.facebook.com/docs/reference/api/batch/

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