Skip to content

Latest commit

 

History

History
246 lines (168 loc) · 3.52 KB

API.md

File metadata and controls

246 lines (168 loc) · 3.52 KB

API

  • This serves as an API for a mobile application for ticket verification via a QR code and for a web administration
  • Below are provided methods with corresponding input and output values
  • Api should run in a provided docker container with https and is BY NO MEANS SECURE as it uses http as communication with outside of it
  • All the authentication must be done by other means, this only uses forwarded basic-auth packets for user-table assignment
  • Use of https for communication with the server on the internet is highly recommended (maybe even mandatory)
  • This api is definitely not 100% bug-free
  • Requirements for python must be met and only Python3 is (and will be) supported
  • Api requires all the provided folders to be present in order to function properly
  • Do not expose this api (or folder with the code) directly to the outside

Browser route: /api/ui/* :


create_table (201, 304, 400, 500, 406)

  • creates a new table for ticket codes
input format:

{
  "table_name": "",
  "size": ""
}

delete_table (200, 304)

  • deletes a table containing ticket codes
input format:

{
  "table_name": ""
}

backup_db (200, 500)

  • backs up databases with codes and assigned users into a zip file
input format:

{}

restore_db (200, 304)

  • restores databases from a zip backup
input format:

{
  "filepath": ""
}

clear_table (200, 304)

  • clears a given table of codes
input format:

{
  "table_name": ""
}

add_entries (201, 304, 400, 500)

  • adds n codes into a table
  • codes are generated based on the internal parameters
input format:

{
  "table_name": "",
  "code": ""
}

select_code (200 + json, 400)

  • returns a row with matching code from a table
input format:

{
  "table_name": "",
  "code": ""
}
output format:

{
    "id": "",
    "code": "",
    "used": "",
    "time": ""
}

update_code (200 + json, 304, 400)

  • updates a code to current time and increments used count
  • returns values pre-update
input format:

{
    "table_name": "",
    "code": ""
}
output format:

{
    "id": "",
    "code": "",
    "used": "",
    "time": ""
}

add_users (200, 304, 400)

  • adds users from a list into the assingment table and assigns them to table_name
input format:

{
    "table_name": "",
    "users": ""
}

delete_all_users (200, 304)

  • deletes all users from assignment table
input format:

{}

delete_users_for_table (200, 304)

  • deletes all users from assginment table assigned to a specific table
input format:

{
    "table_name": ""
}

assigned_user_table (200 + json, 400)

  • returns name of a table the specified user is assigned to
input format:

{
    "user": ""
}
output format:

{
    "table_name": ""
}

export_tickets (200 + json, 400)

  • exports tickets from a table to a file and provides the download link for it
  • currently only supports HTML (printing to pdf on client side browser) and one template with 8 codes
  • TODO: accidentally removed after fedora update completely ruined itself and grub :( (forgot to push) -> restore previous state where printing was to a pdf instead of html
input format:

{
    "table_name": ""
}
output format:

{
    "id": "",
    "code": "",
    "used": "",
    "time": ""
}

WORK IN PROGRESS