Both are used to publish data only, but they have the following difference -
@Body annotations define a single request body.
interface Foo { @POST("/jayson") FooResponse postJson(@Body FooRequest body); }
This means that if you use @Body, it should only be a parameter. This is useful if you already have JsonObject and you want to send it as is with your api call.
Another way: you can send data using @Field and send the Place object as a JSON string.
@POST("/post/addphoto/") public void addImage(@Field("image_url") String url, @Field("caption") String caption, @Field("google_place_id") String placeId, @Field("facebook_place") String place, Callback<UploadCallBack> response);
Hope this helps ... :-)
source share