I am executing a post type request using Multipart. The problem is because I keep getting two errors
1) 500
2) 422 Unprocessable Entity
Everything works in the postman
Api only accepts music files.So I added a default file so as not to constantly choose a new one
RequestBody body =
RequestBody.create(MediaType.parse("audio/type"),file);
MultipartBody.Builder builder = new
MultipartBody.Builder().setType(MultipartBody.FORM);
builder.addPart(body);
GeoService.saveSound(builder.build(), SoundResponseCallback,
getAuthToken());
and my interface which
@Multipart
@POST("audios")
Call<SoundResponse> saveSound(
@Part("audio[file] ; filename=audio.mp3")RequestBody file,
@Query("auth_token") String authToken);
I would appreciate any help.
and I found it Send file to server via retrofit2 as object