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 and GET should use the full resource.
If you just want to update the resource (and just send Bar) then you can also use the PATCH http verb.
A list of restful verbs: https://restful-api-design.readthedocs.org/en/latest/methods.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With