Directus通过ID删除项目

huangapple go评论93阅读模式
英文:

Directus delete Item by ID

问题

在Directus中通过API删除项目的方式如下:

DELETE /items/:collection/:id

我尝试了这个方法,但只收到了一个错误信息:

DELETE /items/parking_reservations/61

"errors": [
    {
        "message": "\"value\" must contain at least one of [query, keys]",
        "extensions": {
            "code": "FAILED_VALIDATION"
        }
    }
]
英文:

How can you delete a item via Api in Directus?

According to the doku the path would be:

> DELETE /items/:collection/:id

I tried this but only got an error:

> DELETE /items/parking_reservations/61

"errors": [
    {
        "message": "\"value\" must contain at least one of [query, keys]",
        "extensions": {
            "code": "FAILED_VALIDATION"
        }
    }
]

答案1

得分: 1

你可以使用Directus中的API通过DELETE方法删除一个项目。您可以通过向items端点发送带有项目ID的请求来执行此操作。例如,如果您想删除ID为42的项目,您可以向以下端点发送DELETE请求:/api/1.1/tables/<table_name>/rows/42

英文:

You can delete an item via the API in Directus using the DELETE method. You can perform this action by sending a request with the item's id to the items endpoint. For example, if you wanted to delete an item with the id of 42, you would send a DELETE request to the following endpoint: /api/1.1/tables/&lt;table_name&gt;/rows/42.

huangapple
  • 本文由 发表于 2023年2月8日 23:57:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/75388421.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定