Reputation: 21
Will we use PUT
or POST
when the identity of resource itself is changing from oldname to newname in the web service?
Upvotes: 2
Views: 1720
Reputation: 590
You can use PATCH request to update data in webservice.
POST means create new and PUT means insert, replace if already exists.
Find more details - click here
Upvotes: 1
Reputation: 84854
Typically POST
is used to create a resource. Since you're not creating a resource better option seems to be PUT
but... PUT
request are idempotent - it means more or less - repeatable in terms of outcome, further reading might be found here. Also PUT
needs to contain the whole resource. Thus, maybe PATCH
is the right choice?
Upvotes: 2