Integračná dokumentácia Help

REST API (ANDROID)

Bowa eKasa supports remote script execution through a simple interface. For integrators, a simple Java class is provided for executing scripts.

Usage

Installation type

Notes

eKasa

yes

eKasa + POS

yes

POS

yes

The Java class LdmRestAPI can be downloaded from:

Link

The EpoPay REST API Server application must be installed on the device

Properties

  • The last 128 executed scripts are stored

  • Scripts are stored in RAM, i.e., non-persistently - executed scripts before device restarts cannot be retrieved after restart.

  • Scripts are executed asynchronously, i.e., a script is queued for processing, and it is possible to query the processing status using the API endpoint.

Constructor

public LdmRestAPI(String ip, int port) public LdmRestAPI(String ip, int port, String userName, String password)

Synchronous approach

Blocking script execution.

public String processFmScript(String script) throws RestException

Example of synchronous invocation

String script = "getVariable:B51\r\n"; LdmRestAPI ldmRestAPI = new LdmRestAPI("192.168.50.123", 48080); String responseScript; try { responseScript = ldmRestAPI.processFmScript(script); } catch (RestException e) { throw new RuntimeException(e); } if (responseScript != null && !responseScript.isEmpty()) { System.out.println(responseScript); }

Asynchronous approach

The API allows for asynchronous script execution. First, the script needs to be queued for processing using the pegasScript method. Subsequently, it is possible to query the processing status using the getTaskStatus method.

public long pegasScript(String script) throws RestException public TasksResponse getTaskStatus(long id) throws RestException

Example of asynchronous invocation

String script = "getVariable:B51\r\n"; LdmRestAPI ldmRestAPI = new LdmRestAPI("192.168.50.123", 48080); // Queuing script for processing long taskId; taskId = ldmRestAPI.pegasScript(script); // Retrieving processing status TasksResponse tasksResponse; do { tasksResponse = ldmRestAPI.getTaskStatus(taskId); } while (tasksResponse.getStatus() == TasksResponse.Status.RUNNING); // Evaluation of the response switch (tasksResponse.getStatus()) { case FINISHED: return tasksResponse.getReport(); case TASK_DOES_NOT_EXIST: throw new TaskDoesNotExistsException("Internal error. Task does not exist"); case FAILURE: throw new TaskProcessingException("Internal error. Task processing error"); default: throw new InternalErrorException("Internal error. Throwing exception because taskResponse status is: " + tasksResponse.getStatus().name()); }

Endpoints description

If integration into another language is needed, direct utilization of the REST Server endpoints is possible

Authenticate

Generating of authentication token

GET http://192.168.50.123:48080/api/authenticate GET /api/authenticate HTTP/1.1 Host: 192.168.50.123:48080 Content-Type: application/json Content-Length: 52 { "userName":"admin", "password":"1111" }

Queueing Pegas script for processing

http://192.168.50.123:48080/api/pegas-script POST /api/pegas-script HTTP/1.1 Host: 192.168.50.123:48080 Content-Type: application/json Authorization: Bearer 34cdbf847f579409a876d250454a361a Content-Length: 45 { "pegasScript":"getVariable:B51\r\n" }

Retrieving processing status

http://192.168.50.123:48080/api/tasks/0 GET /api/tasks/1 HTTP/1.1 Host: 192.168.50.123:48080 Authorization: Bearer 34cdbf847f579409a876d250454a361a
Last modified: 23 februára 2026