logo

Extra Block Types (EBT) - New Layout Builder experience❗

Extra Block Types (EBT) - styled, customizable block types: Slideshows, Tabs, Cards, Accordions and many others. Built-in settings for background, DOM Box, javascript plugins. Experience the future of layout building today.

Demo EBT modules Download EBT modules

❗Extra Paragraph Types (EPT) - New Paragraphs experience

Extra Paragraph Types (EPT) - analogical paragraph based set of modules.

Demo EPT modules Download EPT modules

Scroll

删除现有资源(DELETE)

04/09/2025, by Ivan

本页展示了 JSON:API 模块 的 DELETE 请求示例。

启用删除操作

访问 /admin/config/services/jsonapi
并勾选“Accept all JSON:API create, read, update, and delete operations.”(接受所有 JSON:API 的创建、读取、更新和删除操作)选项。

接受 Create、Read、Update、Delete 方法
接受 Create、Read、Update、Delete 方法

身份验证(Authentication)

DELETE 请求通常需要某种形式的身份验证。以下示例均使用基本身份验证(Basic Authentication)。请启用 HTTP Basic Authentication 模块,为 API 用户(及其角色)设置权限,并在 “Authorization” 请求头中设置经过编码的用户名与密码。

本页示例请求头要求存在一个 Drupal 用户名为 “api”、密码为 “api” 的用户。该用户必须拥有删除目标内容的权限。

请求头(Headers)

所有 DELETE 请求示例均使用以下请求头:

  • Content-Type:application/vnd.api+json
  • Authorization:Basic YXBpOmFwaQ==

基本 DELETE 请求

URL:http://example.com/jsonapi/node/article/{{article_uuid}}

响应

HTTP 204(无内容)响应。响应体为空。
文章 {{article_uuid}} 已被删除。

文章来自 Drupal 文档