0

There is a third party application who is storing the details of all employee of our system. The attributes of employee are id, name, address and age.

I have to design a REST application to communicate with that service. So I will receive a request from UI - create/update/delete employee which I will further send to that third party application with information.

In case of creating a new employee, I have POST end point in which I receive employee data in post body. I will further send this data to third party application to store.

Now lets say I want to update the address of the employee. In this case I will receive employee id and new address from UI which I need to further send it to third party application to update. So my application end point should be PUT or PATCH in this case ?

  • 1
    [Use of PUT vs PATCH methods in REST API real life scenarios](https://stackoverflow.com/questions/28459418/use-of-put-vs-patch-methods-in-rest-api-real-life-scenarios) – Giri Oct 15 '20 at 16:01
  • As a rule of thumb: PUT should always contain complete resource, so you should use PATCH. Unless you consider the address as a separate resource (eg: /users/1/address), then it would be PUT. – Mafor Oct 15 '20 at 18:52

0 Answers0