Should the PATCH method return all fields of the resource in the response body?

后端 未结 3 1505
南笙
南笙 2021-02-02 10:53

Should the PATCH method return all fields of the resource in the response body?
Or should it return only updated fields?

I\'m reading this

For example, i

3条回答
  •  逝去的感伤
    2021-02-02 10:58

    I don't think the REST specification (btw I think you need to be looking at RFC 6902 for this) enforces any strong rules around this (what you should be returning). I'd rather return the whole resource so that the client can use it any way it needs. Theoretically, the client itself knows what what's been patched (at least what the request was). Getting confirmation from the server might not be trivial (especially given that PATCH is mostly used for collections), or at least not worthwhile.

提交回复
热议问题