# smartSCHANK Cash Interface 1.0 – sample requests for the VS Code "REST Client" extension. # Set @host to your SSA and click "Send Request" above a block. # Blocks that use {{postCredit.response.headers.location}} need the POST above them sent first. @host = 192.168.2.39 @base = http://{{host}}/cash/1.0 ### ---------------------------------------------------------------- credits # Request a credit ID. The ID comes back in the Location header as "/". # @name postCredit POST {{base}}/credits ### Book the credit issued above (Location is "/", so no extra slash here). # @prompt PLU # @prompt Waiter # @prompt Count PUT {{base}}/credits{{postCredit.response.headers.location}} Content-Type: application/json { "Waiter": {{Waiter}}, "PLU": {{PLU}}, "Count": {{Count}}, "Table": 1, "Place": 1, "ArticleName": "Test article" } ### Cancel portions of a PLU: request an ID first ... # @name postCancel POST {{base}}/credits ### ... then PUT with a negative Count. 200 = all cancelled, 206 = partly, 410 = nothing open. # @prompt PLU # @prompt Waiter PUT {{base}}/credits{{postCancel.response.headers.location}} Content-Type: application/json { "Waiter": {{Waiter}}, "PLU": {{PLU}}, "Count": -1 } ### Request a voucher credit ID (starts with 990, voucher is printed after the PUT). # @name postVoucher POST {{base}}/credits Content-Type: application/json { "credittype": "vouchereanprint" } ### ... then book it like a normal credit; the SSA prints the voucher. PUT {{base}}/credits{{postVoucher.response.headers.location}} Content-Type: application/json { "Waiter": 1, "PLU": 101, "Count": 1 } ### All open credits booked by cash registers (410 when there are none). GET {{base}}/credits ### One credit by ID. # @prompt creditId GET {{base}}/credits/{{creditId}} ### Withdraw one specific credit. Waiter must match the one who booked it. # @prompt creditId # @prompt Waiter DELETE {{base}}/credits/{{creditId}} Content-Type: application/json { "Waiter": {{Waiter}} } ### Delete open credits and heels of a waiter (Waiter missing or 0 = all waiters). ### Deleting is not a cancellation. 200 = {"Credits": n, "Heels": m}, also when nothing was open. # @prompt Waiter DELETE {{base}}/credits Content-Type: application/json { "Waiter": {{Waiter}}, "Scope": "All" } ### Delete only the heels of all waiters. DELETE {{base}}/credits Content-Type: application/json { "Scope": "Heels" } ### ---------------------------------------------------------------- debits ### Debits waiting for the register (410 when there are none). Read-only. GET {{base}}/debits ### One debit by ID. # @prompt debitId GET {{base}}/debits/{{debitId}} ### Acknowledge one debit. # @prompt debitId DELETE {{base}}/debits/{{debitId}} ### Acknowledge several debits at once. Only the IDs are evaluated. # 410 = at least one of them is not waiting any more, nothing was changed. DELETE {{base}}/debits Content-Type: application/json { "Debits": [ { "ID": 18653 }, { "ID": 18654 } ] } ### ---------------------------------------------------------------- articles ### PLUs and names the SSA knows. GET {{base}}/articlelist