0

I need to know that retrofit 2 supports @Multipart annotation with@Query like this

@Multipart
    @POST("media/upload_media")
    Call<ResponseBody> upload(
        @Part MultipartBody.Part media,
        @Query("user-id") int user_id ,
        @Query("type") String type
     );

I am using this in my application and I am not getting a successful response.

Shashanth
  • 4,995
  • 7
  • 41
  • 51
S.H
  • 139
  • 13
  • _"I am not getting a successful response."_ then what's response? Please [edit] the question and post error log if there any. – Shashanth Dec 03 '18 at 08:20
  • i just want to kow that is it support @Querry ? – S.H Dec 03 '18 at 10:13
  • i just need to know that is it possible to add multiple parameters like @Querry with the Multipart annotation ?/? – S.H Dec 03 '18 at 12:17
  • I'm not sure about that. If I understood your requirements, [@Part](https://futurestud.io/tutorials/retrofit-2-passing-multiple-parts-along-a-file-with-partmap) or `@PartMap` is what you're trying to use. – Shashanth Dec 03 '18 at 16:27
  • can you write a sample cod for me – S.H Dec 04 '18 at 06:54
  • if i tell you my parameters can you help me with a sample code to upload image??\ @Shashanth – S.H Dec 04 '18 at 06:55
  • Read [this](https://stackoverflow.com/a/50310161/5180017) StackOverflow answer. You'll get an idea about uploading file with description. You simply need to use `@Part` annotation with `RequestBody` type instead of `String` or `int`. – Shashanth Dec 05 '18 at 04:20

0 Answers0