[openstack-dev] [api][neutron] question on putting an existing tag

Chris Dent cdent+os at anticdent.org
Fri Feb 26 15:52:12 UTC 2016

On Fri, 26 Feb 2016, Jay Pipes wrote:
> On 02/26/2016 09:02 AM, Akihiro Motoki wrote:
>> We can create a tag by PUT'ing an individual tag:
>> What status code should be returned if a requested tag already exists?
>> PUT /servers/1234567890/tags/qux
>> The guideline defines 201 (+ Location header) on success.
>> In the current neutron implementation proposed, 409 is returned
>> when a requested tag already exists.
> 409 Conflict.

/me gets some paint

Stricly speaking, PUT should be idempotent so every time you put a
qux tag on 123456789 it should return (the same) 2xx.

In the real world things get messy and some implementations return
201 on create and some other 2xx when it is already there. It
shouldn't be an error though.

The time a 409 might be reasonable is if via a header, like an ETag,
we have declared that qux must have a certain state before we accept
a PUT of it.

In some implementations things like 'Etag: 0' are used to say "Only
let this PUT happen if it is a create." That's a bit of a hack but
is useful.

Chris Dent               (¨s¡ã¡õ¡ã)¨s¦à©ß©¥©ß            http://anticdent.org/
freenode: cdent                                         tw: @anticdent

More information about the OpenStack-dev mailing list