angular-odata
angular-odata copied to clipboard
could you please explain why the preferred http method is PUT but not PATCH
this is not really a bug report, but a question.
hi. Thanks for the amazing tool. This tool allows to easily generate all the needed client-side code based on the odata backend services, it is very handy and simple to use. It really simplifies a life for developers.
May I ask you whether there is an option to use PATCH http method other than PUT, when updating the entities using the auto - generated oData services?
Could you please explain why the default one is the PUT http method, but not PATCH? PATCH looks like more effective, as it sends to the odata backend services and updates only the modified properties (instead of the entire entity replacement)?
I'm asking here, because I couldn't find this information in the documentation.
Hi @SamShekhovtsov
To use the http PATCH, the method implemented in the services is modify
.
https://github.com/diegomvh/angular-odata/blob/7b680defaaaf198137d9ec1f742710c80a32d0df/projects/angular-odata/src/lib/services/entity-set.ts#L119
Try to give eloquent names for each http method but they may not be good choices.
- fetchAll, fetchMany and fetchOne -> GET
- create -> POST
- update -> PUT
- modify -> PATCH
- destroy -> DELETE
I hope this helps and thank you very much for giving the library a chance.