【发布时间】:2021-10-18 10:55:55
【问题描述】:
我正在使用 put 来修改资源。我想知道当路径中给定的 id 与给定资源主体的 id 不同时返回的适当状态代码是什么。
例如
REST api 动作方法为:/resources/{id}
主体:
{
"id": "test",
"name": "my_resource"
}
以下 curl 请求应该返回什么 HTTP 状态码?
curl -X PUT 'localhost:8080/resources/test2' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": "test",
"name": "my_resource"
}'
【问题讨论】:
标签: put rest http-status-codes