Let's say I have a user resource (/users/{username}
) and the client uses PUT to update the username. In this case the location of the resource changes (because username is the ID).
That's not idempotent, because you can't perform the same request a second time and get the same result. Does that mean I have to use POST instead?
Additionally I don't know with which status code to reply.
201 (created)
seems not correct, because the resource was not created, just updated. On the other hand you have to give the new location to the client.
Whats the best practice for performing an update resulting in a location change? Probably to forbid it?