Java Question

publish multiple photos to facebook timeline

Can any one help to explain me how to post status with photos(not one photos) using graph api;

I try to add photos to

me/photos
but i don't need to see photos from previous posts.

When i use something like
TIMELINE_ALBUM/photos
to post on the user timeline my photos its works pretty fine but i cant post more than one photo.

com.restfb.FacebookClient facebookClient = new DefaultFacebookClient(user.getSnToken());
FacebookType type = facebookClient.publish(timeline + "/feed", FacebookType.class,binaryAttachment, Parameter.with("message", message));
return new PublishFacebookResult(Const.OK, type.getId());

Answer

If it's about why it does not show decent on the facebook Feed

Long answer

Facebook works as the following.

  • When you upload multiple pictures, there shall be in the wall stream an entry that states that new photos are added to an album (by default timeline).
  • When you upload a single picture, there shall be in the wall stream an entry that states that a new photo was uploaded/posted. (which will also go in timeline album if it was not specified)

But a single post can never have multiple pictures. Only an entry that mentions new photos were added to a certain album. So if you comment on that entry, those comments go to the Album comments.

Short answer

You can not post multiple photos and see them as one single stream entry. Only if Facebook feels like it, it will show in the stream that new photos were added to an album or created. In that case you see multiple thumbnails.

If its pure about being able to upload multiple photos in one API call

you have to do separate API calls, on call per photo by default. Api does not support multi upload for photos.

Edit : Do note that the Facebook platform is continuously changing, so this information could be outdated at some point, but the API still does not support multiple images upload.