I am using Retrofit to POST some data for my back-end. I need to send 3 lines and one custom Place object. That's what I'm doing:
@POST("/post/addphoto/") public void addImage(@Field("image_url") String url, @Field("caption") String caption, @Field("google_place_id") String placeId, @Body Place place, Callback<UploadCallBack> response);
In doing so, I get this error:
@Field parameters can only be used with form encoding.
And when I use @FormUrlEncoded , like this:
@FormUrlEncoded @POST("/post/addphoto/") public void addImage(@Field("image_url") String url, @Field("caption") String caption, @Field("google_place_id") String placeId, @Body Place place, Callback<UploadCallBack> response);
I get this error:
@FormUrlEncoded or @Multipart can not be used with @Body parameter.
How can I make it work?
source share