api - RESTful way to apply a single "state" to a resource -


let's have resource named wallet , want apply kind of flow control on goes in , out of it. call flow-control lock.

for reason flow control called lock don't can't come better naming.

in back-end, applying lock can't done changing boolean , it's complex transition making call external provider , having tree different possible types (states) all_locked, only_input, only_output, or no control-flow @ (no lock).

right idea have following endpoints:

get /wallets (index)

get /wallets/{id} (self)

post /wallets (create)

post /wallets/{id}/lock (apply lock)

put /wallets/{id}/lock (update lock type)

delete /wallets/{id}/lock (delete lock)

it isn't action neither it's simple attribute can part of resource it-self. nor lock independent resource or entity.

i not satisfy naming , design of such api, not sure how make better. argue that, reason wasn't restful: wrong naming (usage of verb), need avoid action in restful api, approach operational, etc.

in situation, restful approach apply such lock ?


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -