#
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
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
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
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
Example responses
200 Response
{
"access_token": "string",
"token_type": "string"
}
Responses
#
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
#
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
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
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
Example responses
200 Response
null
Responses
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
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
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
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
Example responses
200 Response
{
"status": "string",
"message": "string"
}
Responses
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
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
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
#
Body_register_vt_register_vt_post
{
"public_key": "string"
}
Body_register_vt_register_vt_post
#
Properties
#
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
#
HTTPValidationError
{
"detail": [
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
]
}
HTTPValidationError
#
Properties
#
Member
{
"name": "string",
"agree": true
}
Member
#
Properties
#
Token
{
"access_token": "string",
"token_type": "string"
}
Token
#
Properties
#
User
{
"username": "string",
"disabled": true
}
User
#
Properties
#
ValidationError
{
"loc": [
"string"
],
"msg": "string",
"type": "string"
}
ValidationError