Skip to content

Mideye REST API

Introduction

Mideye Server 6 includes a REST API that is disabled by default. While primarily intended for internal development, this API can be enabled to automate various tasks, such as exporting accounting data and authentication logs. Please be aware that the API may undergo changes with new releases.

Enabling API Documentation

To enable API documentation, modify the Mideye Server configuration file as follows:

  • Windows: C:\Program Files (x86)\Mideye Server 6\config\application-prod.yml
  • Linux: /opt/mideyeserver6/config/application-prod.yml

Add the following lines to the end of the file:

springdoc:
    api-docs:
        enabled: true

Save the file and restart the Mideye Server service. Then, access the Web GUI and log in as root.

Note

Only the root role has access to the REST API.

Your application-prod.yml file should resemble the following after the changes:

application:
    switch-host: host.one.com
    switch-backup-host: host.two.com
    switch-port: 11111
    log-path: C:\Program Files (x86)\Mideye Server 6\log

springdoc:
    api-docs:
        enabled: true

Access Documentation

After logging in, navigate to the following URL to access the API documentation:

http://<domain>:<port>/api-docs/

The page should appear as shown below:


Protected Endpoints

Accessing protected endpoints requires a JWT token. To obtain this token, send an authentication request to the server with your username and password in JSON format.

Example:

POST https://localhost:8443/api/authenticate/admin
Content-Type: application/json

{
    "username" : "your_username"
    "password" : "your_password"
}

Upon successful authentication, you will receive a JWT token. Use this token to access protected endpoints by including it in the Authorization header of your requests:

Authorization: Bearer <your_token>