rest – Is rebooting a server idempotent or not?

In his article RESTful Casuistry, Tim Bray claims that rebooting a server is not idempotent:

But I don’t buy it, and here’s why. If I want to update some fields in an existing resource, I’m inclined to think about PUT. But that doesn’t work because it’s supposed to be idempotent, and rebooting a server sure isn’t. Well, OK, do it with POST I guess; no biggie.

Yet in comments Mike Kelly states that it is:

The problem I see here is that ’switching’ to reboot does, infact, seem like an idempotent action – the idea being that a ‘rebooting’ state would actually be a graceful shutdown, to an off state, and back to an on state immediately. Once this rebooting state was initiated any further updates to the rebooting state would be idempotent:

PUT /vm/test-machine/power

{ ’state’: ‘rebooting’ }

The definition of idempotence is given in RFC 7231, § 4.2.2. ‘Idempotent Methods’:

A request method is considered “idempotent” if the intended effect on the server of multiple identical requests with that method is the same as the effect for a single such request. Of the request methods defined by this specification, PUT, DELETE, and safe request methods are idempotent.

Like the definition of safe, the idempotent property only applies to what has been requested by the user; a server is free to log each request separately, retain a revision control history, or implement other non-idempotent side effects for each idempotent request.

Idempotent methods are distinguished because the request can be repeated automatically if a communication failure occurs before the client is able to read the server’s response. For example, if a client sends a PUT request and the underlying connection is closed before any response is received, then the client can establish a new connection and retry the idempotent request. It knows that repeating the request will have the same intended effect, even if the original request succeeded, though the response might differ.

The intended effect in our situation is that the server has rebooted. I think this will be the case after both a single or multiple reboot requests. So I am inclined to agree with Mike Kelly that rebooting a server is idempotent. But I don’t share his view that it is because subsequent reboot requests during the rebooting phase do not produce any side effects; to me it is because subsequent reboot requests after the rebooting phase produce the same side effects.

Is rebooting a server idempotent or not?