我很想了解更多关于 PUT 调用的 RESTful 设计模式。具体来说,我在 PUT 调用中更改资源 ID 是否违反了规范?
考虑以下...
POST /api/event/ { ... } - returns the resource ID (eventid) of the new event in the body
GET /api/event/eventid
PUT /api/event/eventid - returns the (possibly new) resource ID depending on request body
GET /api/event/eventid - fails if the original eventid was used in the URI
如果 eventid 表示内部资源(如数据库记录),则 GET 和 PUT 的端点可以快速访问资源。如果 PUT 导致服务器移动底层资源,则 ID 可能会更改。
我这样做是否违反了规范?