For example, there is resource on URI: /api/items/123
Response body for GET request is {"Id": "123", "Foo": "foo", "Bar": "bar"}
I send PUT request. The body of it is {"Bar": "newBarValue"}
In case of this request body, should properties Id and Foo be removed? Or just Bar property should be modified? Or server should return error code?
PUT 和 GET 应使用完整资源。
如果您只想更新资源(并且只发送 Bar),那么您也可以使用 PATCH http 动词。
安静动词列表: https://restful-api-design.readthedocs.org/en/latest/methods.html
| 归档时间: |
|
| 查看次数: |
1030 次 |
| 最近记录: |