POST method in REST must be use only to create resources? -


several authors in rest architecture, post method should used create new resource, , put method used update existing resource (or create new one). problem put method idempotent, if resource has date field named "updatedtime" must set in server side reliability, updated operation no longer idempotent (because value of "updatedtime" change in each new operation), put can not used, , post used create new object how fix this?

as per http's definition of idempotent :

like definition of safe, idempotent property applies to
has been requested user; server free log each
request separately, retain revision control history, or implement
other non-idempotent side effects each idempotent request
.

so you're free modify updated time in underlying server object long doesn't affect resource served http server.

if you're concerned breaking idempotency (although 1 debate whether real violation), therefore advise store updatedtime in server object field expose information through appropriate last-modified header instead of putting in response body represents resource.

as side note, post not create resources (see the spec)


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -