Service

Overview

The fiskaly Service is a built version of fiskaly Client which can be easily used in certain programming/scripting languages where it is hard to embed our client library. The service, as client, uses a slightly modified version of the JSON-RPC 2.0 Protocol to describe requests, responses and errors. The only deviation from the specification concerns notifications, which are not implemented and cause an error. Please make sure you are familiar with the JSON-RPC 2.0 specification before continuing.

Download

It is shipped as an executable file for different operating systems and architectures on our download page.

Run

Windows

./com.fiskaly.service-windows-amd64-v1.1.600.exe

Linux

./com.fiskaly.service-linux-amd64-v1.1.600

Usage

The fiskaly Service starts HTTP Server on port 8080 by default. The port can be changed by changing system variable FISKALY_LISTEN_ADDRESS.

The JSON-RPC Endpoint is /invoke, and all defined methods can be invoked by sending POST requests with right parameters as described in our client library.

Methods

Detailed description of the available JSON-RPC Methods can be found on our client library page.

Examples

Create Context Method

Request

curl --header "Content-Type: application/json" \
--request POST \
--data '{
"jsonrpc": "2.0",
"method": "create-context",
"params": {
"api_key": "'"$API_KEY"'",
"api_secret": "'"$API_SECRET"'",
"base_url": "https://kassensichv.io/api/v1/"
},
"id": 1
}' \
http://localhost:8080/invoke

Configuration

Request

curl --header "Content-Type: application/json" \
--request POST \
--data '{
"jsonrpc": "2.0",
"method": "config",
"params": {
"config": {
"debug_level": 2,
"debug_file": "/var/log/fiskaly.log",
"client_timeout": 5000,
"smaers_timeout": 2000
},
"context": "'"$CONTEXT"'"
},
"id": 2
}' \
http://localhost:8080/invoke

Version

Request

curl --header "Content-Type: application/json" \
--request POST \
--data '{
"jsonrpc": "2.0",
"method": "version",
"params": {},
"id": 3
}' \
http://localhost:8080/invoke

API Request

Request

curl --header "Content-Type: application/json" \
--request POST \
--data '{
"jsonrpc": "2.0",
"method": "request",
"params": {
"request": {
"method": "PUT",
"path": "/tss/ecb75169-680f-48d1-93b2-52cc10abb9ff/tx/9cbe6566-e24c-42ac-97fe-6a0112fb3c63",
"query": { "last_revision": "0" },
"headers": { "Content-Type": "application/json" },
"body": "eyJzdGF0ZSI6ICJBQ1RJVkUiLCJjbGllbnRfaWQiOiAiYTYyNzgwYjAtMTFiYi00MThhLTk3MzYtZjQ3Y2E5NzVlNTE1In0="
},
"context": "'"$CONTEXT"'"
},
"id": 4
}' \
http://localhost:8080/invoke

Errors

The fiskaly Service will return errors as defined in the JSON-RPC 2.0 specification. For detailed information on errors visit client library errors

Debug mode

To assist troubleshooting, the fiskaly Service includes a debug mode. When enabled, information with variable granularity will be written to a log file. The verbosity is controlled by the debug_level field in the configuration. Valid debug levels are -1 (no output), 1 (errors only), 2 (errors+warnings) and 3 (errors+warnings+info). The output file can also be set via the config method. Default is /tmp/fiskaly.log.

SDK

In order to make the implementation of fiskaly Service easier, we have developed open-source SDKs for many programming languages such as PHP and Node.js.

The SDKs provide wrapper functions for our service and they are updated with every release of the client.

For a detailed description of SDKs visit our download page.

Last updated on