Skip to content
Andrey Khozov edited this page Sep 14, 2019 · 1 revision

[http] /api/info

Schema:

{
  "start": int, // unixtime for start game
  "end": int, // unixtime for end game
  "service": { // dictionary with services (id -> name mapping)
    "id1": "name1",
    "id2": "name2",
    ...
  },
  "teams": { // dictionary with teams
    "id1": {
      "id": int, // team id
      "name": text, // team name
      "host": ipv4|hostname, // optional, host with game image
      "network": cidr, // network for team
      "logo": text, // optional, URL for team logo
      "country": text // optional, country of team
    },
    ...
  }
}

Example:

$ curl -s http://example.com/api/info | json_pp
{
   "start" : 1356998400,
   "end" : 1836172799,
   "services" : {
      "1" : "down",
      "2" : "up",
      "3" : "down2",
      "4" : "timeout"
   },
   "teams" : {
      "1" : {
         "country" : "Russia",
         "host" : "127.0.1.3",
         "id" : 1,
         "logo" : "http://example.com",
         "name" : "team1",
         "network" : "127.0.1.0/24"
      },
      "2" : {
         "country" : "United States",
         "host" : "127.0.2.3",
         "id" : 2,
         "name" : "team2 (b)",
         "network" : "127.0.2.0/24"
      },
      "3" : {
         "host" : "127.0.3.3",
         "id" : 3,
         "name" : "team3 (b)",
         "network" : "127.0.3.0/24"
      }
   }
}

[websocket] /api/events

Schema

{
  "type": state|attack, // type of event
  "value": { // for state type
    "round": int, // current round
    "scoreboard": [{ // sorted array of teams in scoreboard
      "n": int, // position in scoreboard
      "name": text, // team name
      "host": ipv4|hostname, // optional, team host
      "d": int, // delta for preivious position
      "score": float, // current score for team
      "old_score": float, // score for previous round
      "services": [{ // detailed info for services
        "id": int, // service id
        "flags": int, // number fo flags
        "sflags": int, // number of stolen flags
        "sla": float, // SLA in percentage (0% - 100%)
        "fp": float, // FP
        "status": int, // status of service (101, 102, 103, 104, 110, 111)
        "stdout": text // stdout from checker
      }, {
        ...
      }],
      "old_services": [...] // detailed info for services from previous round
    }, {
      ...
    }],
    "services": { // dictionary with services and status
      "id1": {
        "name": text, // service name
        "active": 0|1 // service status for current round
      },
      ...
    }
  },
  "value": { // for state attack
    "service_id": int,
    "attacker_id": int,
    "victim_id": int
  }
}

Example (type: state)

{"type":"state","value":{"round":382,"scoreboard":[{"d":0,"host":"127.0.2.3","n":1,"name":"team2 (b)","old_score":"623.05","old_services":[{"flags":0,"fp":3.0,"id":1,"sflags":0,"sla":100.0,"status":111,"stdout":null},{"flags":0,"fp":3.0,"id":2,"sflags":0,"sla":0.0,"status":104,"stdout":""},{"flags":368,"fp":645.47,"id":3,"sflags":0,"sla":96.06,"status":101,"stdout":""},{"flags":0,"fp":3.0,"id":4,"sflags":0,"sla":0.0,"status":104,"stdout":""}],"round":382,"score":"624.78","services":[{"flags":0,"fp":3.0,"id":1,"sflags":0,"sla":100.0,"status":111,"stdout":null},{"flags":0,"fp":3.0,"id":2,"sflags":0,"sla":0.0,"status":104,"stdout":""},{"flags":369,"fp":647.2,"id":3,"sflags":0,"sla":96.07,"status":101,"stdout":""},{"flags":0,"fp":3.0,"id":4,"sflags":0,"sla":0.0,"status":104,"stdout":""}],"team_id":2},{"d":0,"host":"127.0.3.3","n":2,"name":"team3 (b)","old_score":"3.00","old_services":[{"flags":0,"fp":3.0,"id":1,"sflags":0,"sla":100.0,"status":111,"stdout":null},{"flags":0,"fp":3.0,"id":2,"sflags":0,"sla":0.0,"status":104,"stdout":""},{"flags":0,"fp":0.0,"id":3,"sflags":368,"sla":96.06,"status":101,"stdout":""},{"flags":0,"fp":3.0,"id":4,"sflags":0,"sla":0.0,"status":104,"stdout":""}],"round":382,"score":"3.00","services":[{"flags":0,"fp":3.0,"id":1,"sflags":0,"sla":100.0,"status":111,"stdout":null},{"flags":0,"fp":3.0,"id":2,"sflags":0,"sla":0.0,"status":104,"stdout":""},{"flags":0,"fp":0.0,"id":3,"sflags":369,"sla":96.07,"status":101,"stdout":""},{"flags":0,"fp":3.0,"id":4,"sflags":0,"sla":0.0,"status":104,"stdout":""}],"team_id":3},{"d":0,"host":"127.0.1.3","n":2,"name":"team1","old_score":"3.00","old_services":[{"flags":0,"fp":3.0,"id":1,"sflags":0,"sla":100.0,"status":111,"stdout":null},{"flags":0,"fp":3.0,"id":2,"sflags":0,"sla":0.0,"status":110,"stdout":null},{"flags":0,"fp":3.0,"id":3,"sflags":0,"sla":0.0,"status":104,"stdout":"some error!\n"},{"flags":0,"fp":3.0,"id":4,"sflags":0,"sla":0.0,"status":104,"stdout":""}],"round":382,"score":"3.00","services":[{"flags":0,"fp":3.0,"id":1,"sflags":0,"sla":100.0,"status":111,"stdout":null},{"flags":0,"fp":3.0,"id":2,"sflags":0,"sla":0.0,"status":110,"stdout":null},{"flags":0,"fp":3.0,"id":3,"sflags":0,"sla":0.0,"status":104,"stdout":"some error!\n"},{"flags":0,"fp":3.0,"id":4,"sflags":0,"sla":0.0,"status":104,"stdout":""}],"team_id":1}],"services":{"1":{"active":0,"name":"down"},"2":{"active":1,"name":"up"},"3":{"active":1,"name":"down2"},"4":{"active":1,"name":"timeout"}}}}

Example (type: attack)

{"type":"attack","value":{"attacker_id":2,"round":384,"service_id":3,"victim_id":3}}
Clone this wiki locally