# Voting process manager

Hlavná služba na gateway-i zodpovedná za spustenie a zastavenie volieb, registráciu volebných terminálov, poskytuje informáciu o stave pripojených terminálov a udalosti o spustení a zastavení volieb. Rovnako zabezpečuje generovanie zápisnice a odoslanie zápisnice na server.

# Registrácia volebného terminálu

Pri spustení volebného terminálu sa terminál dopytuje na endpoint /register-vt kedy sa pri spustenej registrácii vymení verejný kľúč gataway-a, aby mohla prebiehať šifrovaná komunikácia medzi volebným terminálom a gateway-om. Ak registrácia nie je spustená, vráti sa status 400.

# Komunikácia medzi volebným terminálom

Táto služba komunikuje so všetkými registrovanými volebnými terminálmi pomocou websocketov. Vo websockete sa posiela udalosť actual_state, ktorá obsahuje aktuálny stav volieb volebným terminálom. Rovnako aj volebné terminály notifikujú gateway o ich aktuálnom stave udalosťou vt_status.

# Popis API

# root__get

Code samples

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/gateway/voting-process-manager-api/', headers = headers)

print(r.json())

GET /

Root

Simple hello message.

Example responses

200 Response

{
  "status": "string",
  "message": "string"
}

Responses

Status Meaning Description Schema
200 OK Successful Response Inline

Response Schema

# election_config_election_config_get

Code samples

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/gateway/voting-process-manager-api/election-config', headers = headers)

print(r.json())

GET /election-config

Election Config

Returns necessary config fields for gateway from config.

Example responses

200 Response

{
  "status": "string",
  "texts": {}
}

Responses

Status Meaning Description Schema
200 OK Successful Response Inline

Response Schema

# terminals_status_terminals_status_get

Code samples

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('/gateway/voting-process-manager-api/terminals-status', headers = headers)

print(r.json())

GET /terminals-status

Terminals Status

Returns necessary staus information of connected voting terminals.

Example responses

200 Response

{
  "status": "string",
  "registration_status": false,
  "terminals": [

  ]
}

Responses

Status Meaning Description Schema
200 OK Successful Response Inline

Response Schema

# login_for_access_token_token_post

Code samples

import requests
headers = {
  'Content-Type': 'application/x-www-form-urlencoded',
  'Accept': 'application/json'
}

r = requests.post('/gateway/voting-process-manager-api/token', headers = headers)

print(r.json())

POST /token

Login For Access Token

Log in user using username and password.

Body parameter

grant_type: string
username: string
password: string
scope: ""
client_id: string
client_secret: string

Parameters

Name In Type Required Description
body body Body_login_for_access_token_token_post true none

Example responses

200 Response

{
  "access_token": "string",
  "token_type": "string"
}

Responses

Status Meaning Description Schema
200 OK Successful Response Token
422 Unprocessable Entity Validation Error HTTPValidationError

# current_user_current_user__get

Code samples

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('/gateway/voting-process-manager-api/current-user/', headers = headers)

print(r.json())

GET /current-user/

Current User

Example responses

200 Response

{
  "username": "string",
  "disabled": true
}

Responses

Status Meaning Description Schema
200 OK Successful Response User

# start_voting_process_start_post

Code samples

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/gateway/voting-process-manager-api/start', headers = headers)

print(r.json())

POST /start

Start Voting Process

Starts elections and notify all voting terminals.

Example responses

200 Response

{
  "status": "string",
}

Responses

Status Meaning Description Schema
200 OK Successful Response Inline

Response Schema

# end_voting_process_end_post

Code samples

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.post('/gateway/voting-process-manager-api/end', headers = headers)

print(r.json())

POST /end

End Voting Process

Stops elections and notify all voting terminals.

Example responses

200 Response

{
  "status": "string",
}

Responses

Status Meaning Description Schema
200 OK Successful Response Inline

Response Schema

# register_vt_register_vt_post

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('/gateway/voting-process-manager-api/register-vt', headers = headers)

print(r.json())

POST /register-vt

Register Vt

Register a voting terminal. Returns status 400 if registration is disabled else return status 200 with id and public key.

Body parameter

{
  "public_key": "string"
}

Parameters

Name In Type Required Description
body body Body_register_vt_register_vt_post true none

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
422 Unprocessable Entity Validation Error HTTPValidationError

Response Schema

# gateway_events_gateway_elections_events_get

Code samples

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('/gateway/voting-process-manager-api/gateway-elections-events', headers = headers)

print(r.json())

GET /gateway-elections-events

Gateway Events

Get all elections events of start and end of elections.

Example responses

200 Response

{
  "status": "success",
  "events": []
}

Responses

Status Meaning Description Schema
200 OK Successful Response Inline

Response Schema

# get_first_start_gateway_elections_events_first_start_get

Code samples

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('/gateway/voting-process-manager-api/gateway-elections-events/first-start', headers = headers)

print(r.json())

GET /gateway-elections-events/first-start

Get First Start

Get first start of elections.

Example responses

200 Response

{
  "status": "string",
  "first_start": {}
}

Responses

Status Meaning Description Schema
200 OK Successful Response Inline

Response Schema

# get_last_end_gateway_elections_events_last_end_get

Code samples

import requests
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {access-token}'
}

r = requests.get('/gateway/voting-process-manager-api/gateway-elections-events/last-end', headers = headers)

print(r.json())

GET /gateway-elections-events/last-end

Get Last End

Get last end of elections.

Example responses

200 Response

{
  "status": "string",
  "last_end": {}
}

Responses

Status Meaning Description Schema
200 OK Successful Response Inline

Response Schema

# generate_commission_paper_commission_paper_generate_post

Code samples

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('/gateway/voting-process-manager-api/commission-paper/generate', headers = headers)

print(r.json())

POST /commission-paper/generate

Generate Commission Paper

Generate commission paper in pdf format encoded in base64 and store it into database.

Body parameter

{
  "polling_place_id": 0,
  "participated_members": [
    {
      "name": "Erik Malina",
      "agree": true
    },
    {
      "name": "Ferko Jablko",
      "agree": false
    },
    {
      "name": "Adam Jahoda",
      "agree": true
    }
  ],
  "president": {
    "name": "Samo Čerešňa",
    "agree": true
  }
}

Parameters

Name In Type Required Description
body body CommissionPaper true none

Example responses

200 Response

{
  "status": "string",
  "message": "string"
}

Responses

Status Meaning Description Schema
200 OK Successful Response Inline
422 Unprocessable Entity Validation Error HTTPValidationError

Response Schema

# get_commission_paper_commission_paper_get

Code samples

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/gateway/voting-process-manager-api/commission-paper', headers = headers)

print(r.json())

GET /commission-paper

Get Commission Paper

Get commission paper from database encoded in base64.

Example responses

200 Response

{
  "status": "string",
  "data": "string"
}

Responses

Status Meaning Description Schema
200 OK Successful Response Inline

Response Schema

# send_commission_paper_commission_paper_send_post

Code samples

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.post('/gateway/voting-process-manager-api/commission-paper/send', headers = headers)

print(r.json())

POST /commission-paper/send

Send Commission Paper

Send commission paper to server.

Example responses

200 Response

{
  "status": "string",
  "message": "string"
}

Responses

Status Meaning Description Schema
200 OK Successful Response Inline

Response Schema

# Schemas

# Body_login_for_access_token_token_post

{
  "grant_type": "string",
  "username": "string",
  "password": "string",
  "scope": "",
  "client_id": "string",
  "client_secret": "string"
}

Body_login_for_access_token_token_post

# Properties
Name Type Required Restrictions Description
grant_type string false none none
username string true none none
password string true none none
scope string false none none
client_id string false none none
client_secret string false none none

# Body_register_vt_register_vt_post

{
  "public_key": "string"
}

Body_register_vt_register_vt_post

# Properties
Name Type Required Restrictions Description
public_key string true none none

# CommissionPaper

{
  "polling_place_id": 0,
  "participated_members": [
    {
      "name": "Erik Malina",
      "agree": true
    },
    {
      "name": "Ferko Jablko",
      "agree": false
    },
    {
      "name": "Adam Jahoda",
      "agree": true
    }
  ],
  "president": {
    "name": "Samo Čerešňa",
    "agree": true
  }

CommissionPaper

# Properties
Name Type Required Restrictions Description
polling_place_id integer true none none
participated_members [Member] false none none
president Member true none none

# HTTPValidationError

{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}

HTTPValidationError

# Properties
Name Type Required Restrictions Description
detail [ValidationError] false none none

# Member

{
  "name": "string",
  "agree": true
}

Member

# Properties
Name Type Required Restrictions Description
name string true none none
agree boolean true none none

# Token

{
  "access_token": "string",
  "token_type": "string"
}

Token

# Properties
Name Type Required Restrictions Description
access_token string true none none
token_type string true none none

# User

{
  "username": "string",
  "disabled": true
}

User

# Properties
Name Type Required Restrictions Description
username string true none none
disabled boolean false none none

# ValidationError

{
  "loc": [
    "string"
  ],
  "msg": "string",
  "type": "string"
}

ValidationError

# Properties
Name Type Required Restrictions Description
loc [string] true none none
msg string true none none
type string true none none