Somebody
Somebody

Reputation: 9645

Facebook Application: Uploading multiple images in one post to wall

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 request.

curl -F "access_token=token_here" -F "message=message_here" -F "picture=http://www.example.com/image.jpg" https://graph.facebook.com/app_id_here/feed

Or it's not possible to post multiple images this way?

Anyone?

Thanks ;)

Upvotes: 3

Views: 6116

Answers (3)

Kcoder
Kcoder

Reputation: 3480

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

Upvotes: 0

borisdiakur
borisdiakur

Reputation: 12072

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/

Upvotes: 1

Vikas Gupta
Vikas Gupta

Reputation: 109

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/

Upvotes: 0

Related Questions