Gre*_*reg 7 api rest web-services
我很想知道围绕PUT调用的RESTful设计模式的更多信息.具体来说,我是否通过将资源ID更改为PUT调用的一部分来违反规范?
考虑以下...
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
Run Code Online (Sandbox Code Playgroud)
如果eventid表示内部资源(如数据库记录),则GET和PUT的端点可以快速访问资源.如果PUT导致服务器移动底层资源,则ID可以更改.
我这样做时违反了规范吗?