Authentication

SIHOT.POS authenticates at your server with credentials that you provide to the hotel. Your server returns a token, and SIHOT.POS sends this token with every following request.

Credentials

You provide the following values to the hotel. The hotel enters them in the configuration of the voucher interface in SIHOT.POS:

Value Description
Base URL URL of your server, for example https://voucher.example.com/v1/. See Implementation Basics.
Customer id Id that you assign to the hotel. SIHOT.POS sends it as customerId.
User name SIHOT.POS sends it as userName.
Password SIHOT.POS sends it as userPassword.

Token Request

SIHOT.POS requests a token when it needs one for the first time.

Request – POST <base URL>auth/token

JSON
{
  "customerId": "K4712",
  "userName": "pos-restaurant",
  "userPassword": "********"
}

Response

Return the token in the field value with HTTP status 200:

JSON
{
  "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
NOTE

SIHOT.POS sends the path in lower case: auth/token. Make sure your server accepts it.

Token Usage

SIHOT.POS sends the token in the header Authorization of every voucher request:

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
IMPORTANT

SIHOT.POS keeps the token and does not request a new one when your server answers with 401. It requests a new token only after a network error. Issue tokens that stay valid, and do not invalidate them, for example when your server restarts. Otherwise, SIHOT.POS cannot use your server until SIHOT.POS is restarted.

Errors

If the credentials are wrong, answer with an error status and a JSON body without the field value, for example the error object. SIHOT.POS then sends the voucher request with an empty token; reject it with 401. The cashier sees that the voucher status is unknown. SIHOT.POS requests a token again with the next GetVoucher request.

If the response to the token request has an empty body or a body that is not JSON, SIHOT.POS sends no voucher request, and the cashier sees a connection error.