Skip to content
This repository was archived by the owner on Nov 12, 2024. It is now read-only.

API Endpoints

dremerb edited this page Aug 20, 2022 · 11 revisions

Login

URI:

  • /login

Method:

  • POST

Fields:

Field Description
user Username
pwd Password for user. sha256 hash

Returns:

  • Successful login: Access Token for authentication, HTTP 200
  • Failed login: HTTP 401

Register

URI:

  • /register

Method:

  • POST

Fields:

Field Description
user Username to register
pwd Password for user. Must be sha256 hash of user provided value.
mail Mail for password resets. Must be sha256 hash of user provided value.

Returns

  • HTTP 201 on success
  • HTTP 409 on fail

Data

URI:

  • /data.json

Method:

  • GET

Returns:

  • Example: {"serverinfo": [{"Server 1": [223, 854.000459, [223, 227, 231, 235, 236, 237, 238, 244, 245, 246, 247, 248, 252, 254, 259, 260, 262, 266, 267, 269, 272, 274, 275, 201, 202, 204, 205, 206, 208, 210, 211, 212, 215, 219, 220], 15]}, {"Server 2": [251, 702.000323, [251, 253, 255, 257, 264, 265, 268, 270, 203, 207, 209, 213, 214, 216, 221, 224, 225, 226, 229, 230, 233, 242, 243, 249, 250], 15]}, {"Server 3": [234, 412.00024, [234, 239, 240, 241, 256, 258, 261, 263, 271, 273, 217, 218, 222, 228, 232], 20]}], "timeleft": [10040, 22, 24, 1], "curtimestr": "23:35"}
  • serverinfo
    • Available servers and their state
      • State: [current map, time played, playlist, timelimit]
  • timeleft
    • Time remaining until end of competition
  • curtimestr
    • Current time in CET

Finishes

URI:

  • fin.json

Method:

  • POST

Headers: Header Name: Authorization Header Type: Bearer Value: JWT Token

Returns:

  • Example: {"finishes":4,"mapids":[100,101,102,103]}
  • finishes
    • Number of total finishes in this event
  • mapids
    • List of maps finished in this event

Logout

URI:

  • /logout

Method:

  • GET

Headers:

  • Header Name: Authorization
  • Header Type: Bearer
  • Value: JWT Token

Returns HTTP 200

Note: Server blacklists JWT Token. Frontend needs to remove cookie containing token, so that it is not used anymore.

Spreadsheet - GET

Get data for the spreadsheet. If user is authenticated, contains user specific data, otherwise only common information.

URI:

  • /spreadsheet

Method

  • GET

Headers:

  • Header Name: Authorization
  • Header Type: Bearer
  • Value: JWT Token

Returns

{
  "202": {
    "map_diff": 0,
    "map_pb": "17:42", 
    "map_rank": 19, 
    "clip": "", 
    "alarm": true, 
    "finished": false,
    "upcomingIn": 3554,
    "server": "Kackiest Kacky 7 - Server 1"
},
...
}

Key of top level dict is Kacky ID.

  • map_diff = difficulty set by user. unset = 0
  • map_pb = personal best on map in millis. unset = -1
  • map_rank = numerical local record. unset = 0
  • clip = clip saved by user. unset = ""
  • alarm = Discord notification enabled. unset = ""
  • finished = has user finished the map or not?
  • upcomingIn = time until next juke of map. Time in minutes
  • server = server, on which map is juked next

Spreadsheet - POST

Allows saving modified fields in the spreadsheet.
URI:

  • /spreadsheet

Method:

  • POST

Headers:

  • Header Name: Authorization
  • Header Type: Bearer
  • Value: JWT Token

Fields:
mapid is required! Others are optional.

Field Description Datatype
mapid Kacky ID for this map. int
diff Difficulty for map int, range 0 - 6
clip Clip for map str, max length = 150
alarm If this field is set, Discord alarm is TOGGLED. Send mapid as value in this anyways, idk what else. int

Return
HTTP200 on success.
HTTP400 on bad values.

Usermanagement

URI:

  • /usermgnt

Method:

  • POST

Headers:

  • Header Name: Authorization
  • Header Type: Bearer
  • Value: JWT Token

Fields:

Field Description
pwd New password for user. sha256 hash
mail New mail for user. sha256 hash
tmnf New tmnf login for user.
tm20 New tm20 login for user.
discord New discord id for user.

Returns
HTTP 200

TODO

  • spreadsheet_line (only get a line from the spreadsheet, identified by mapid)
Clone this wiki locally