# smartSCHANK Cloud Cash Interface v1 – sample requests for the VS Code "REST Client" extension. # 1. Pick the environment below (test or production) and the account. # 2. Send the "token" request first. Every other request takes token and API key from its response. @BASE_TEST = devapp.smartschank.com/ords/dirmeier/selfserviceCash @BASE_PROD = app.smartschank.com/ords/dirmeier/selfserviceCash @host = {{BASE_TEST}} @username = selfservice.demo@dirmeier.de @password = Demo2025 ### ---------------------------------------------------------------- sign in # @name token POST https://{{host}}/token Content-Type: application/json Accept: application/json { "grant_type": "password", "username": "{{username}}", "password": "{{password}}" } ### ---------------------------------------------------------------- credits ### All credits of the department (200 with an empty list when there are none). GET https://{{host}}/v1/credits Authorization: Bearer {{token.response.body.access_token}} x-api-key: {{token.response.body.x-api-key}} Accept: application/json ### Only free credits (state 0). Filters combine: state_filter, plu_filter, tag_id. GET https://{{host}}/v1/credits?state_filter=0 Authorization: Bearer {{token.response.body.access_token}} x-api-key: {{token.response.body.x-api-key}} Accept: application/json ### Free credits of one tag. # @prompt tagId GET https://{{host}}/v1/credits?state_filter=0&tag_id={{tagId}} Authorization: Bearer {{token.response.body.access_token}} x-api-key: {{token.response.body.x-api-key}} Accept: application/json ### Credits of one PLU. # @prompt PLU GET https://{{host}}/v1/credits?plu_filter={{PLU}} Authorization: Bearer {{token.response.body.access_token}} x-api-key: {{token.response.body.x-api-key}} Accept: application/json ### Request a credit ID. The Location header holds the URL of the new credit. # @name postCredit POST https://{{host}}/v1/credits Content-Type: application/json Authorization: Bearer {{token.response.body.access_token}} x-api-key: {{token.response.body.x-api-key}} Accept: application/json { "credittype": "default" } ### Fill the credit issued above. Works once per credit ID. # @prompt PLU # @prompt Count # @prompt TagID PUT {{postCredit.response.headers.location}} Content-Type: application/json Authorization: Bearer {{token.response.body.access_token}} x-api-key: {{token.response.body.x-api-key}} Accept: application/json { "PLU": {{PLU}}, "Count": {{Count}}, "TagID": "{{TagID}}", "ArticleName": "Soda 0,2l", "Price": 3.14, "Waiter": 4, "Table": 5, "Place": 6 } ### Cancel a free credit. 404 = no such credit, 409 = credit is not free. # @prompt creditId DELETE https://{{host}}/v1/credits/{{creditId}} Content-Type: application/json Authorization: Bearer {{token.response.body.access_token}} x-api-key: {{token.response.body.x-api-key}} Accept: application/json {} ### ---------------------------------------------------------------- tags ### Is this tag still in use? Looks back the given number of hours. # @prompt tagId GET https://{{host}}/v1/tags/{{tagId}}?hours_to_look_back=200 Authorization: Bearer {{token.response.body.access_token}} x-api-key: {{token.response.body.x-api-key}} Accept: application/json ### Generate an unused numeric tag with the given number of digits. POST https://{{host}}/v1/tags/generator?tag_length=5 Authorization: Bearer {{token.response.body.access_token}} x-api-key: {{token.response.body.x-api-key}} Accept: application/json