I am using Retrofit to POST some data to my back-end. I need to send 3 Strings and one custom Place object. Here is what I am 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);
With this, I am getting 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 do I make it work?