API.md: - Add export formats (JSON, XML, EGF, FFG, CSV) - Document /explain endpoint for pairing analysis - Add PUT /standings for freezing - Improve parameter documentation - Fix typos (regitration -> registration, #tip -> #tid) configuration.md: - Add property loading hierarchy - Document SSL/TLS configuration - Add OAuth provider configuration - Add ratings.path property - Include example configurations model.md: - Complete entity diagram with Team, external IDs - Document all tournament types (PAIRGO, RENGO, TEAM) - Add TimeSystem types and parameters - Document all pairing parameters - List all 39 tiebreak criteria - Add external database (AGA, EGF, FFG) documentation
8.3 KiB
Pairgoth API specification
General remarks
The API expects an Accept header of application/json, with no encoding or an UTF-8 encoding. Exceptions are some export operations which can have different MIME types to specify the expected format:
application/json- JSON output (default)application/xml- OpenGotha XML exportapplication/egf- EGF formatapplication/ffg- FFG formattext/csv- CSV format
GET requests return either an array or an object, as specified below.
POST, PUT and DELETE requests return either the 200 HTTP code with { "success": true } (with an optional "id" field for some POST requests), or an invalid HTTP code and (for some errors) the body { "success": false, "error": <error message> }.
All POST/PUT/DELETE requests use read/write locks for concurrency. GET requests use read locks.
When authentication is enabled, all requests require an Authorization header.
Synopsis
- /api/tour GET POST Tournaments handling
- /api/tour/#tid GET PUT DELETE Tournaments handling
- /api/tour/#tid/part GET POST Registration handling
- /api/tour/#tid/part/#pid GET PUT DELETE Registration handling
- /api/tour/#tid/team GET POST Team handling
- /api/tour/#tid/team/#tid GET PUT DELETE Team handling
- /api/tour/#tid/pair/#rn GET POST PUT DELETE Pairing
- /api/tour/#tid/res/#rn GET PUT DELETE Results
- /api/tour/#tid/standings GET PUT Standings
- /api/tour/#tid/stand/#rn GET Standings
- /api/tour/#tid/explain/#rn GET Pairing explanation
- /api/token GET POST DELETE Authentication
Tournament handling
-
GET /api/tourGet a list of known tournaments idsoutput json map (id towards shortName) of known tournaments
-
GET /api/tour/#tidGet the details of tournament #tidoutput json object for tournament #tid
Supports
Accept: application/xmlto get OpenGotha XML export. -
POST /api/tourCreate a new tournamentinput json object for new tournament, or OpenGotha XML with
Content-Type: application/xmlTournament JSON structure:
{ "type": "INDIVIDUAL", "name": "Tournament Name", "shortName": "TN", "startDate": "2024-01-15", "endDate": "2024-01-16", "country": "fr", "location": "Paris", "online": false, "rounds": 5, "gobanSize": 19, "rules": "FRENCH", "komi": 7.5, "timeSystem": { ... }, "pairing": { ... } }Tournament types:
INDIVIDUAL,PAIRGO,RENGO2,RENGO3,TEAM2,TEAM3,TEAM4,TEAM5output
{ "success": true, "id": #tid } -
PUT /api/tour/#tidModify a tournamentinput json object for updated tournament (only id and updated fields required)
output
{ "success": true } -
DELETE /api/tour/#tidDelete a tournamentoutput
{ "success": true }
Players handling
-
GET /api/tour/#tid/partGet a list of registered playersoutput json array of known players
-
GET /api/tour/#tid/part/#pidGet registration details for player #pidoutput json object for player #pid
-
POST /api/tour/#tid/partRegister a new playerinput
{ "name": "Lastname", "firstname": "Firstname", "rating": 1500, "rank": -5, "country": "FR", "club": "Club Name", "final": true, "mmsCorrection": 0, "egfId": "12345678", "ffgId": "12345", "agaId": "12345" }Rank values: -30 (30k) to 8 (9D). Rating in EGF-style (100 = 1 stone).
output
{ "success": true, "id": #pid } -
PUT /api/tour/#tid/part/#pidModify a player registrationinput json object for updated registration (only id and updated fields required)
output
{ "success": true } -
DELETE /api/tour/#tid/part/#pidDelete a player registrationoutput
{ "success": true }
Teams handling
For team tournaments (PAIRGO, RENGO2, RENGO3, TEAM2-5).
-
GET /api/tour/#tid/teamGet a list of registered teamsoutput json array of known teams
-
GET /api/tour/#tid/team/#teamidGet registration details for team #teamidoutput json object for team #teamid
-
POST /api/tour/#tid/teamRegister a new teaminput
{ "name": "Team Name", "playerIds": [1, 2, 3], "final": true, "mmsCorrection": 0 }output
{ "success": true, "id": #teamid } -
PUT /api/tour/#tid/team/#teamidModify a team registrationinput json object for updated registration (only id and updated fields required)
output
{ "success": true } -
DELETE /api/tour/#tid/team/#teamidDelete a team registrationoutput
{ "success": true }
Pairing
-
GET /api/tour/#tid/pair/#rnGet pairable players for round #rnoutput
{ "games": [ { "id": 1, "t": 1, "w": 2, "b": 3, "h": 0 }, ... ], "pairables": [ 4, 5, ... ], "unpairables": [ 6, 7, ... ] }games: existing pairings for the roundpairables: player IDs available for pairing (not skipping, not already paired)unpairables: player IDs skipping the round
-
POST /api/tour/#tid/pair/#rnGenerate pairing for round #rninput
[ "all" ]or[ #pid, ... ]Optional query parameters:
legacy=true- Use legacy pairing algorithmweights_output=<file>- Output weights to file for debuggingappend=true- Append to weights output file
output
[ { "id": #gid, "t": table, "w": #wpid, "b": #bpid, "h": handicap }, ... ] -
PUT /api/tour/#tid/pair/#rnManual pairing or table renumberingFor manual pairing: input
{ "id": #gid, "w": #wpid, "b": #bpid, "h": <handicap> }For table renumbering: input
{ "renumber": <game_id or null>, "orderBy": "mms" | "table" }output
{ "success": true } -
DELETE /api/tour/#tid/pair/#rnDelete pairing for round #rninput
[ "all" ]or[ #gid, ... ]Games with results already entered are skipped unless
"all"is specified.output
{ "success": true }
Results
-
GET /api/tour/#tid/res/#rnGet results for round #rnoutput
[ { "id": #gid, "res": <result> }, ... ]Result codes:
"w"- White won"b"- Black won"="- Jigo (draw)"X"- Cancelled"?"- Unknown (not yet played)"#"- Both win (unusual)"0"- Both lose (unusual)
-
PUT /api/tour/#tid/res/#rnSave a resultinput
{ "id": #gid, "res": <result> }output
{ "success": true } -
DELETE /api/tour/#tid/res/#rnClear all results for roundoutput
{ "success": true }
Standings
-
GET /api/tour/#tid/standingsGet standings after final roundoutput
[ { "id": #pid, "place": place, "<crit>": value }, ... ]Supports multiple output formats via Accept header:
application/json- JSON (default)application/egf- EGF formatapplication/ffg- FFG formattext/csv- CSV format
Optional query parameters:
include_preliminary=true- Include preliminary standingsindividual_standings=true- For team tournaments with individual scoring
-
GET /api/tour/#tid/stand/#rnGet standings after round #rnUse round
0for initial standings.output
[ { "id": #pid, "place": place, "<crit>": value }, ... ]Criteria names include:
nbw,mms,sts,cps,sosw,sosm,sososw,sososm,sodosw,sodosm,cussw,cussm,dc,sdc,ext,exr, etc. -
PUT /api/tour/#tid/standingsFreeze/lock standingsoutput
{ "success": true }
Pairing explanation
-
GET /api/tour/#tid/explain/#rnGet detailed pairing criteria weights for round #rnoutput Detailed pairing weight analysis and criteria breakdown
Used for debugging and understanding pairing decisions.
Authentication
-
GET /api/tokenCheck authentication statusoutput Token information for the currently logged user, or error if not authenticated.
-
POST /api/tokenCreate an access tokeninput Authentication credentials (format depends on auth mode)
output
{ "success": true, "token": "..." } -
DELETE /api/tokenLogout / revoke tokenoutput
{ "success": true }