I'm working on an kind of an RPG game. And I'm trying to figure out a nice, clean and RESTful way to define inventory API.
inventory consists of several slots like head, chest etc (like in most RPG games).
Now I need to define REST API to move all items from slot X to slot Y.
few ideas I had:
- well, obviously the inventory lives at
/inventory - so 1st idea was to have smth like
/inventory/movementand to have aCREATEon that to make itCRUD. so it will bePOST /inventory/movement. this will be CRUD and REST, but it feels very bad. - another one was to have some magic attributes on the inventory and to just do update on it:
PUT /inventory?move_from=A&move_to=B. This still doesn't feel too good.
so.. any idea for a clean CRUD REST solution for this?
UPDATE: just had another one: PUT /inventory/:to_slot?from=:from_slot - not sure still. why is the action on just one slot when 2 are involved? hmm... ugh!