# Voting service

Služba zodpovedná za overovanie prichdádzajúceho tokenu a za prijímanie hlasu z volebného terminálu.

# Popis API

# hello__get

Code samples

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

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

print(r.json())

GET /

Hello

Sample testing endpoint

Example responses

200 Response

null

Responses

Status Meaning Description Schema
200 OK Successful Response Inline

Response Schema

# vote_api_vote_post

Code samples

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

r = requests.post('/gateway/voting-service-api/api/vote', headers = headers)

print(r.json())

POST /api/vote

Vote

Receives vote with valid token, validates the token, sotres the vote and invalidates the token.

Returns: 200: Vote was successfully stored 403: Token is invalid 409: The election is not running at the moment 422: Invalid request body

Body parameter

{
  "voting_terminal_id": "string",
  "payload": {
    "encrypted_message": "string",
    "encrypted_object": "string"
  }
}

Parameters

Name In Type Required Description
body body Body_vote_api_vote_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

# token_validity_api_token_validity_post

Code samples

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

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

print(r.json())

POST /api/token-validity

Token Validity

Checks if the provided token is valid.

Body parameter

{
  "voting_terminal_id": "string",
  "payload": {
    "encrypted_message": "string",
    "encrypted_object": "string"
  }
}

Parameters

Name In Type Required Description
body body Body_token_validity_api_token_validity_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

# Schemas

# Body_token_validity_api_token_validity_post

{
  "voting_terminal_id": "string",
  "payload": {
    "encrypted_message": "string",
    "encrypted_object": "string"
  }
}

Body_token_validity_api_token_validity_post

# Properties
Name Type Required Restrictions Description
voting_terminal_id string true none none
payload VoteEncrypted true none Attributes
----------
encrypted_message: str
AES encrypted message.
encrypted_object: str
RSA encrypted AES key and other data.

# Body_vote_api_vote_post

{
  "voting_terminal_id": "string",
  "payload": {
    "encrypted_message": "string",
    "encrypted_object": "string"
  }
}

Body_vote_api_vote_post

# Properties
Name Type Required Restrictions Description
voting_terminal_id string true none none
payload VoteEncrypted true none Attributes
----------
encrypted_message: str
AES encrypted message.
encrypted_object: str
RSA encrypted AES key and other data.

# HTTPValidationError

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

HTTPValidationError

# Properties
Name Type Required Restrictions Description
detail [ValidationError] 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

# VoteEncrypted

{
  "encrypted_message": "string",
  "encrypted_object": "string"
}

VoteEncrypted

# Properties
Name Type Required Restrictions Description
encrypted_message string true none none
encrypted_object string true none none