Home > Enterprise >  How to realize Path Variable in retrofit 2
How to realize Path Variable in retrofit 2

Time:12-22

I can't send DELETE request with path variable. It's working in Postman. Please help me.

UPD:

API Interface: @HTTP(method = "DELETE", path = "users/id:{id}", hasBody = true) fun deleteUser(@Path("id") id: String): Call<ResponseBody>

CodePudding user response:

If you are using retrofit 2. Try like this

@DELETE("delete_labour/{id}")
Call<JsonElement> delete_item(@Path("id")String id,
                                @Header("token")String token);

CodePudding user response:

try this snippet below

@DELETE("users/{id}")
fun deleteUser(@Path("id") id: String): Call<ResponseBody>
  • Related