I use Retrofit2 to send files to the server, the POST request takes two parameters file and shared-with , I use this code:

  @FormUrlEncoded @Multipart @POST("shared-with") Call<RequestBody> sendFile(@Part MultipartBody.Part file, @Field("shared-with") String sharedWith); 

I get this error: Only one encoding annotation is allowed . How to correctly rewrite this query?

    1 answer 1

    You can not mix FormUrlEncoded and Multipart

     @Multipart @POST("shared-with") Call<RequestBody> sendFile(@Part MultipartBody.Part file, @Part("shared-with") RequestBody sharedWith); 
    • Thank. helped - Lucky_girl