I'm using Retrofit and I want to make a request with tge delete method. I want to use a specific body, but the delete method doesn't support that. I created my custom class for delete method like this:
@Target(METHOD)
@Retention(RUNTIME)
@RestMethod( hasBody = true,value = "DELETE")
public @interface CustomDelete {
String value();
}
But when I use it I have this error:
10-31 16:24:09.459: I/System.out(21090): retrofit.RetrofitError: DELETE does not support writing
Try this (with Retrofit 2.0):
@FormUrlEncoded
@HTTP(method = "DELETE", path = "/api/resource/etc", hasBody = true)
Call<ApiResponse> deleteSomething(@Field("id") int id);
@HTTP(method = "DELETE",path="/api/v1/media/{username}/{accesstoken}", hasBody = true)
Call<MyResponse> deleteArchiveMedia(@Path("username") String username, @Path("accesstoken") String token ,
@Body DeleteMedia deleteMedia);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With