I am trying to send the following in a Multipart-form
request using Retrofit
:
{ "attachment": {
"file_cache": "....."
"original": "upload/image.png",
"versions": {
"small": "uploads/small_image.png"
}
},
"content": "",
"id": 1
}
I don't know if this is a correct request I should be sending to the API, since their documentation is really horrible but I was able to use Chrome Dev Tools to study what the API was receiving request wise and how it was responding, it seems to accept that JSON.
Here is a photo of what I observed:
Their documentation only states that "attachment"
should be an object.
Is it possible at all to send a POJO
object in a multipart-form
request? My REST Interface looks like this:
@Multipart
@POST("/v2/{type}/{id}/message.json")
void addMessage(@Path("type") String type,
@Path("id") int id,
@Part("content") String content,
@Part("attachment") MultipartTypedOutput multipartTypedOutput,
Callback<Post> callback);
Sending a MultipartTypedOutput
didn't work, neither did using the following:
addMessage(...., @Part("attachment") POJOObject object, ...);
Any ideas on how to accomplish this?
I get a status 422
un-processable entity if I try to send a POJO
object with Retrofit
.