I would like to know how to add a picture to an event using the Facebook Graph API. I have seen this question and tried some variations on that theme, without any success. The official documentation doesn't seem to make any mention of it.
I'm using PHP for this particular project and I've looked at the PHP SDK source code, which is not helpful in any way. Requesting metadata for pictures using https://graph.facebook.com/eventid/picture?metadata=1&access_token... doesn't seem to be recognized, so no help there either.
Has anyone come across some example or documentation on how to do this? (don't care about which language it is in)
This is supported by the Graph API, however it is poorly documented. You need to send the image as multipart attachment in the POST request. Try this:
curl -F 'access_token=...' \
-F 'name=Test Event' \
-F 'description=The description' \
-F 'start_time=2012-09-01T12:00:00+0000' \
-F '@file.jpg=@/path/to/image.jpg' \
https://graph.facebook.com/me/events
That event should have a picture.
They have recently added support for this to the PHP SDK.
I've forked their python-sdk and added multipart support, and added a simple put_event method that accepts a url for a picture, as well as the usual params.
While searching for the problem, i found following links which might be of interest.
http://wiki.developers.facebook.com/index.php/PHP
http://wiki.developers.facebook.com/index.php/Photos.upload
http://developers.facebook.com/docs/reference/rest/
In last link, check "Publishing methods" and "Dashboard API methods". It has methods for Video and Photo uploading.
Photo: http://developers.facebook.com/docs/reference/rest/photos.upload
Video: http://developers.facebook.com/docs/reference/rest/video.upload
--------------EDIT---21st May,2010,8:58 PM IST---------------------
Check this thread out, it shows photo uploding code in PHP using graph API which you mentioned.
Upload Photo To Album with Facebook's Graph API
I hope this helps.
thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With