OK, this is two years old, but I'm going to answer it in case someone else stumbles upon it as I did.
The short answer is that, from HTTP point of view, renaming (moving) resources is not idempotent, and you should have used POST
instead of PUT
.
The long answer: PUT
is a "create-or-replace" operation, defined by RFC 2616 as follows (emphasis mine):
The PUT
method requests that the enclosed entity be stored under the supplied Request-URI.
RFC 7231 (which at the time this question was asked existed only as draft), puts it more clearly:
The PUT
method requests that the state of the target resource be
created or replaced with the state defined by the representation
enclosed in the request message payload. A successful PUT
of a given
representation would suggest that a subsequent GET
on that same
target resource will result in an equivalent representation being
sent in a 200
(OK
) response.
Because a successful rename will result in the resource being available at a different location, PUT
is not applicable.
PS. Probably you could have made this work with PUT
by including some sort of unique identifier for the company, regardless of it's name or other attributes, in the request body, that would allow you to detect previous renames and issue an appropriate redirect. Nevertheless, I think it is going against the protocol, and POST
would have been more appropriate.