Hello!
I'm trying to post a photo-set on my tumblr blog and the documentation is confusing me.
It states that when I submit the request, the "data" data type should be
"Array (URL-encoded binary contents)".
I
guessed that this means that I have to convert my image into bytes and
store it as an array of bytes and pass that as an argument but I'm
getting a "Bad Request" exception.
(Exception in thread "main" com.tumblr.jumblr.exceptions.JumblrException: Bad Request)
Here's my method:
public static void postToTumblr(List<String> post_imagePath, String post_source, String post_caption)
{ // Using only the first image in the ArrayList for the sake of testing...
File initialFile = new File(post_imagePath.get(0));
InputStream targetStream = new FileInputStream(initialFile);
byte[]
image = IOUtils.toByteArray(targetStream);
params.clear();
params.put("type", "photo");
params.put("caption", post_caption);
params.put("data", image);
params.put("source_url", post_source);
params.put("source_title", post_source);
params.put("source", post_source);
client.postCreate("blogname.tumblr.com", params);
}
What do I pass in for the data field to get it to post multiple images??