Try this
INTERFACE
@POST("/Your ENDPOINT")
public Call<ResponseBody> sendImages(@Body body: RequestBody)
MAKE YOUR BODY
MultipartBody.Builder builder = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("order_id",orderId)
.addFormDataPart("return_attributes[qr_code]",qrCode)
.addFormDataPart("return_attributes[reason]","100")
.addFormDataPart("return_attributes[description]","(31/12/2020 13:30:00)");
for (File file:listFiles){
builder.addFormDataPart("return_attributes[images]",file.getName(),
RequestBody.create(MediaType.parse("image/*"),
file.getAbsolutePath()));
}
BUILD AND ENQUEUE YOUR REQUEST
RequestBody body=builder.build();
Service service = retrofit.create(ApiAlfa.class);
ApiAlfa.sendImages(body).enqueue(...);
you can see this too
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…