Are there any examples on how to post a photo.

125 views
Skip to first unread message

John Gentilin

unread,
Jan 11, 2012, 3:28:16 AM1/11/12
to BatchFB
I am trying to post a photo to an event..

Thanks
John G

Jeff Schnitzer

unread,
Jan 12, 2012, 9:41:18 AM1/12/12
to bat...@googlegroups.com
Hmmm, doesn't look like there are any examples in the BatchFB docs and
the Facebook documentation is pretty thin. Here's the PHP example,
which you should be able to translate to Java/BatchFB:

https://developers.facebook.com/blog/post/498/

With BatchFB you make a post() and one of the params you submit is a
BinaryParam which holds the image data. I'm not sure it matters what
you name the parameter, but the PHP example calls it "source". The
post url is "/me/photos".

Jeff

John Gentilin

unread,
Jan 14, 2012, 11:28:04 PM1/14/12
to BatchFB
Looking at the Code, there is a RequestBuilder that can handle binary
attachments but the execute method
returns an HTTPResponse so I am thinking that is remnants of the REST
API code. There is also a BinaryParam
class, but when I post a BinaryParam, I get a JSON error saying,
"Don't know what to do with a BinaryParam yet"
so I am using a combination of BatchFB for paged request, and RestFB
for binary uploads.

-John Gentilin

Jeff Schnitzer

unread,
Jan 15, 2012, 12:06:19 AM1/15/12
to bat...@googlegroups.com
Heh, oops. That code path was never carried over from BatchFB 1.x,
almost certainly because the mechanism for binary upload in the batch
graph api was not defined when that code was written. On the plus
side, Facebook has since implemented and documented batch binary
uploads so I can add it.

I will get this working in the next day or two and cut a new release.

Jeff

John Gentilin

unread,
Jan 15, 2012, 12:58:16 AM1/15/12
to bat...@googlegroups.com, Jeff Schnitzer
Cool, once you post, I can test.. Currently I am having a issue uploading
images to an event, I think it's a FB issue but it would be super fantastic
if it was some other factor..

See
http://facebook.stackoverflow.com/questions/8834107/upload-event-photo-using-graph-api-or-any-other-way
https://developers.facebook.com/bugs/225316074217855?browse=search_4f126aa99d4f28a72688708

-John G

Jon Nolan

unread,
Sep 18, 2012, 12:25:52 PM9/18/12
to bat...@googlegroups.com, Jeff Schnitzer
Jeff,

Did you ever get BinaryParam working? I suspect not. I'm getting the
"Not quite sure what to do with BinaryParam yet" JSON exception using
2.1.2.

Thanks
--
Jon

Jeff Schnitzer

unread,
Sep 18, 2012, 1:11:29 PM9/18/12
to bat...@googlegroups.com
No, I haven't. Sorry about that. It should be fairly easy to add if
you want to take a stab at it. I can guide you over IM.
Unfortunately I'm still swamped with work.

Jeff

Jon Nolan

unread,
Sep 18, 2012, 2:15:21 PM9/18/12
to bat...@googlegroups.com
Understood. I'll dig in and see where it leads me. I may take you up
on your IM offer.

Thanks Jeff.
Reply all
Reply to author
Forward
0 new messages