> For the complete documentation index, see [llms.txt](https://potoyang.gitbook.io/spring-in-action-v5/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://potoyang.gitbook.io/spring-in-action-v5/di-7-zhang-tiao-yong-rest-fu-wu/7.1-shi-yong-resttemplate-tiao-yong-rest-duan-dian/7.1.3-qing-qiu-delete-zi-yuan.md).

# 7.1.3 请求 DELETE 资源

假设 Taco Cloud 不再提供一种配料，并希望将其作为一种选项完全删除。要做到这一点，可以从 RestTemplate 中调用 delete() 方法：

```java
public void deleteIngredient(Ingredient ingredient) {
    rest.delete("http://localhost:8080/ingredients/{id}",
               ingredient.getId());
}
```

在本例中，仅将 URL（指定为 String）和 URL 变量值赋给 delete()。但是，与其他 RestTemplate 方法一样，可以将 URL 指定为 URI 对象，或者将 URL 参数指定为 Map。
