Closed confile closed 11 years ago
Hi Michael,
I've just release on new version of the plugin (0.4.4) where publish method takes InputStream argument type (instead of FileInputStream). So it should be much more easier now.
I've updated the docs:
// Publishing an image to a photo album is easy!
// Just specify the image you'd like to upload and RestFB will handle it from there.
def publishPhotoResponse = facebookClient.publishFile("me/photos", [message, "Test cat"], "/Users/ben/Downloads/cat.png")
println "Published photo ID: " + publishPhotoResponse.id
// Publish a submitted file
def publishPhotoResponse = facebookClient.publishFile("me/photos", [message, "Test upload"], multipartFile.originalFilename, multipartFile.inputStream)
// Publish an existing remote file by URL
def someUrl = "http://www.google.com/images/logo.gif"
def publishPhotoResponse = facebookClient.publishFile("me/photos", [message, "Test logo"], "logo.gif", new URL(someUrl).openStream())
println "Published photo ID: " + publishPhotoResponse.id
// Publishing a video works the same way.
facebookClient.publish("me/videos", [message, "Test cat"], "/Users/ben/Downloads/cat.mov")
Let me know if it is working as expected on your side.
Thanks!
This is what I did and it is not working. Do you have a working sample for me?
can you provide me some sample code which is working?