How to upload a byte array of an image with Imgur Upload API

45 views
Skip to first unread message

dcdan...@gmail.com

unread,
May 25, 2016, 3:47:56 PM5/25/16
to Imgur
Tried to configure the Upload API call as follows:

RequestBody uploadTitle = RequestBody.create(MediaType.parse("text/plain"), imageTitle);
RequestBody uploadDesc = RequestBody.create(MediaType.parse("text/plain"), imageDescription);
RequestBody uploadType = RequestBody.create(MediaType.parse("image/jpeg"), "base64");
RequestBody uploadFile = RequestBody.create(MediaType.parse("image/jpeg"), imageInBytes);

But, the returned Status Code: 400
This error indicates that a required parameter is missing or a parameter has a value that is out of bounds or otherwise incorrect. This status code is also returned when image uploads fail due to images that are corrupt or do not meet the format requirements.


How should this be formatted?

Reply all
Reply to author
Forward
0 new messages