is the following a correct way to see how Idempotent works for a REST PUT
Given X is a request
Context_N indicates information about the context in which the operation is execute, but do not influence the state
- e.g. Device/user information
State_XN is the state after executing an operation
- Resource/Entity State as use in Real world
Meta_XN is the metadata captured or internal information in the system generated by the operation
- For example
- Audit AuthZ claims- Path or ID of record in storage- Timestamp when record is applied in the system initially recorded
initial state = (X, void, void ) // X Does not existsPUT(X,Context_1) = (X, State_X1, Meta_X1) PUT(X,Context_2) = (X, State_X2, Meta_X2) Delete(X) = (X, void, void ) // X Does not exists PUT(X,Context_3) = (X, State_X3, Meta_X3)
Based on idempotency the following MUST be true
State_X1 == State_X2 == State_X3
But might
Meta_X1 <> Meta_X2 and Meta_X1 <> Meta_X3