android – Having trouble with making an API request which has retrofit and @POST with two separate ByteArrays-ThrowExceptions

Exception or error:

So I’ve an API which allows me to upload two different photos. A full image and a cropped image. Those two photos are in the form of ByteArray’s.

This is the body of the API call

{
    fullImage: ByteArray,
    croppedImage: ByteArray,
    imageName: String
}

My question here is, how do I upload/send this API request in Android via retrofit?

This is what I’ve come up with and it doesn’t work. I believe it’s because of @Query parameter.

@POST("v2/selfie")
fun uploadSelfie(@Query("fullImage") fullImage: ByteArray,
                 @Query("croppedImage") croppedImage: ByteArray,
                 @Query("imageName") hash: String): Completable
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *