Daniel Klöck
Daniel Klöck

Reputation: 21137

PUT with optional parameters

I must fulfill a web service with PUT as method to send changes. This service is used to change configurations. So, for example, if I send {"varA":true} to url/configurationchageit sets the corresponding variable, and if I send {"varB":true} it changes varB without affecting varA.

I always though that PUT (and searching google it seems as if I am right) just overwrites the resource (or creates it if not existing). Which I think would mean that I always have to send all variables, or the ones that are not sent will be deleted. So, is the behavior of this web service correct??

WITH EXAMPLES

PUT {"varA":true}
Resource content: {"varA": true}

PUT {varB:true}

Upvotes: 0

Views: 750

Answers (1)

Julian Reschke
Julian Reschke

Reputation: 42027

No, it's not. You probably want to look at the PATCH method instead (see http://greenbytes.de/tech/webdav/rfc5789.html)

Upvotes: 2

Related Questions