How to perform a DELETE request without return type or Callback? [Retrofit]
You have to add Callback as last argument in request method if you want to have void method. You can useCallback<Response>
.
You have to change this:
@DELETE("/api/item/{id}")
void deleteItem(@Path("id") int itemId);
to :
@DELETE("/api/item/{id}")
void deleteItem(@Path("id") int itemId, Callback<Response> callback);
Or you can return just Response
@DELETE("/api/item/{id}")
Response deleteItem(@Path("id") int itemId);
In Retrofit 2.0, You can use Call interface for the result of your request as below.
@DELETE("/api/item/{id}")
Call<Response> deleteItem(@Path("id") int itemId);
...
Call<Response> call = YourServiceInstance.deleteItem(10);
call.enqueue(new Callback<Response>() {
...
});