I am building a REST API for warehouse inventory picking.
I have a very shallow understanding of REST, so to me that just == stateless and try to make your URL mappings nouns instead of verbs.
The picking process looks like this:
Scan QR on a the shipping instruction sheet which contains an order number along with all SKU's and their quantities. This could be thought of as an aggregate for the entire picking transaction, kicking off the order as "in progress".
Iterate the following steps until all SKUs are picked
2.a: Scan QR on the physical location being picked from
2.b: Scan QR on the inventory container at the location
2.c: Scan QR on the customer label that will be attached to the inventory container
Scan QR on the physical delivery location and drop off the order
Each one of these steps has it's own API endpoint and needs to validate things like
- Does the order number match the order this user is currently picking?
- Is this location allowed to be picked from for this order number?
- Is this a valid inventory container for the order? (SKU not already picked, SKU actually on the order, correct quantity, that sort of thing)
- Does the SKU on the customer label match the SKU that was previously scanned on the inventory container?
I don't understand how I could create a stateless REST API that meets these requirements. Without state, how do I validate the integrity of every request to make sure the order is being picked correctly?
I had the thought that maybe I'll just have the client pass in the current state of the order on every request (giving me all the data I need to validate a request) but then that assumes I actually trust the client to maintain the correct state, which of course is a bad idea.
Or maybe I could maintain the state of the order on a backend database, and have the client pass me the order number on every request to look it up? This just seems like state with extra steps.
Or maybe I need to move past the idea that this HAS to be a stateless system and break the rules of REST?
Thanks in advance for any advice!