Sutirth Sutirth - 1 month ago 15
Android Question

Retrofit 2 Unable to Use Delete tag with Body

I have my call Implemented as

@HTTP(method = "DELETE", hasBody = true)
@DELETE("groups/{groupId}/members/remove")
Call<GroupRemoveUserModel> putRemoveUser(@Path("groupId") int groupId, @Body GroupRemoveUserModel groupRemoveUserModel);


where model code is as follows :

public final class GroupRemoveUserModel {

public GroupRemoveUserModel(int userId){
this.userId = userId;
}
}


However when I call the method with appropriate parameters it doesn't work moreover cannot get any stack trace as well already using okhttp logger for debugging

Answer

Try using this:

@HTTP(method = "DELETE", path = "groups/{groupId}/members/remove", hasBody = true)
Call<GroupRemoveUserModel> putRemoveUser(@Path("groupId") int groupId, @Body GroupRemoveUserModel groupRemoveUserModel);