3 ms·
Assuming the request is valid, PUT should work without regard to whether the resource existed already. You're asserting what should be there, and if it works,
by randallsquared 15y ago
Assuming the request is valid, PUT should work without regard to whether the resource existed already. You're asserting what should be there, and if it works, then it either creates it or overwrites what was there before.
You have to use PUT to enable creating something only when the server URL that the resource will be available at is not known to the client.
- alexchamberlain 15y agoIs 404 not a valid return for a PUT? And I assume you mean POST for paragraph 2?
- randallsquared 15y agoI wouldn't think that 404 makes any sense for PUT, no. Similarly, "410 Gone" would be a confusing result, at least. I did mean "POST" in paragraph 2, yes. Thanks. :)