{
  "openapi" : "3.0.1",
  "info" : {
    "title" : "Event Bracket Rest APIs",
    "description" : "Create tournaments, add participants, generate bracket and include it in your web site. Please use Basic authentication for all of the APIs.",
    "version" : "v1"
  },
  "servers" : [ {
    "url" : "/rest",
    "description" : "EventBracket REST API"
  } ],
  "paths" : {
    "/v1/tournaments/{tournamentId}/bracket" : {
      "get" : {
        "tags" : [ "Bracket Rest Services" ],
        "summary" : "Retrieve bracket for a tournament",
        "operationId" : "retrieveBracket",
        "parameters" : [ {
          "name" : "Organization-Id",
          "in" : "header",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        }, {
          "name" : "tournamentId",
          "in" : "path",
          "required" : true,
          "schema" : {
            "minimum" : 1,
            "type" : "integer",
            "format" : "int64"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "Successful operation",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/BracketResponse"
                }
              },
              "application/xml" : {
                "schema" : {
                  "$ref" : "#/components/schemas/BracketResponse"
                }
              }
            }
          },
          "404" : {
            "description" : "Bracket not found"
          },
          "401" : {
            "description" : "Unauthorized"
          },
          "500" : {
            "description" : "Something wrong in Server"
          }
        },
        "security" : [ {
          "basicAuth" : [ ]
        } ]
      },
      "post" : {
        "tags" : [ "Bracket Rest Services" ],
        "summary" : "Generate bracket for the tournament",
        "operationId" : "createBracket",
        "parameters" : [ {
          "name" : "Organization-Id",
          "in" : "header",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        }, {
          "name" : "tournamentId",
          "in" : "path",
          "required" : true,
          "schema" : {
            "minimum" : 1,
            "type" : "integer",
            "format" : "int64"
          }
        } ],
        "responses" : {
          "201" : {
            "description" : "Created",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/BracketResponse"
                }
              },
              "application/xml" : {
                "schema" : {
                  "$ref" : "#/components/schemas/BracketResponse"
                }
              }
            }
          },
          "400" : {
            "description" : "Could not create bracket",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              },
              "application/xml" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized"
          },
          "500" : {
            "description" : "Something wrong in Server"
          }
        },
        "security" : [ {
          "basicAuth" : [ ]
        } ]
      },
      "delete" : {
        "tags" : [ "Bracket Rest Services" ],
        "summary" : "Delete bracket for the tournament",
        "operationId" : "deleteBracket",
        "parameters" : [ {
          "name" : "Organization-Id",
          "in" : "header",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        }, {
          "name" : "tournamentId",
          "in" : "path",
          "required" : true,
          "schema" : {
            "minimum" : 1,
            "type" : "integer",
            "format" : "int64"
          }
        } ],
        "responses" : {
          "204" : {
            "description" : "Bracket deleted successfully"
          },
          "404" : {
            "description" : "Bracket not found"
          },
          "401" : {
            "description" : "Unauthorized"
          },
          "500" : {
            "description" : "Something wrong in Server"
          }
        },
        "security" : [ {
          "basicAuth" : [ ]
        } ]
      }
    },
    "/v1/tournaments/{tournamentId}/participants" : {
      "get" : {
        "tags" : [ "Participants Rest Services" ],
        "summary" : "Retrieve all participants of a tournament",
        "operationId" : "retrieveParticipants",
        "parameters" : [ {
          "name" : "Organization-Id",
          "in" : "header",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        }, {
          "name" : "tournamentId",
          "in" : "path",
          "required" : true,
          "schema" : {
            "minimum" : 1,
            "type" : "integer",
            "format" : "int64"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "Successful operation",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ParticipantResponse"
                }
              },
              "application/xml" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ParticipantResponse"
                }
              }
            }
          },
          "404" : {
            "description" : "No participants found"
          },
          "401" : {
            "description" : "Unauthorized"
          },
          "500" : {
            "description" : "Something wrong in Server"
          }
        },
        "security" : [ {
          "basicAuth" : [ ]
        } ]
      },
      "post" : {
        "tags" : [ "Participants Rest Services" ],
        "summary" : "Add participants to tournament",
        "operationId" : "createParticipants",
        "parameters" : [ {
          "name" : "Organization-Id",
          "in" : "header",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        }, {
          "name" : "tournamentId",
          "in" : "path",
          "required" : true,
          "schema" : {
            "minimum" : 1,
            "type" : "integer",
            "format" : "int64"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "type" : "array",
                "items" : {
                  "type" : "string"
                }
              }
            },
            "application/xml" : {
              "schema" : {
                "type" : "array",
                "items" : {
                  "type" : "string"
                }
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "201" : {
            "description" : "Created",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ParticipantResponse"
                }
              },
              "application/xml" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ParticipantResponse"
                }
              }
            }
          },
          "400" : {
            "description" : "Could not add participants",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              },
              "application/xml" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized"
          },
          "500" : {
            "description" : "Something wrong in Server"
          }
        },
        "security" : [ {
          "basicAuth" : [ ]
        } ]
      },
      "delete" : {
        "tags" : [ "Participants Rest Services" ],
        "summary" : "Delete all participants",
        "operationId" : "deleteAllParticipants",
        "parameters" : [ {
          "name" : "Organization-Id",
          "in" : "header",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        }, {
          "name" : "tournamentId",
          "in" : "path",
          "required" : true,
          "schema" : {
            "minimum" : 1,
            "type" : "integer",
            "format" : "int64"
          }
        } ],
        "responses" : {
          "204" : {
            "description" : "All participants deleted successfully"
          },
          "404" : {
            "description" : "Participants not Found"
          },
          "401" : {
            "description" : "Unauthorized"
          },
          "500" : {
            "description" : "Something wrong in Server"
          }
        },
        "security" : [ {
          "basicAuth" : [ ]
        } ]
      }
    },
    "/v1/tournaments/{tournamentId}/participants/{particpantName}" : {
      "delete" : {
        "tags" : [ "Participants Rest Services" ],
        "summary" : "Delete participant by name",
        "operationId" : "deleteParticipant",
        "parameters" : [ {
          "name" : "Organization-Id",
          "in" : "header",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        }, {
          "name" : "tournamentId",
          "in" : "path",
          "required" : true,
          "schema" : {
            "minimum" : 1,
            "type" : "integer",
            "format" : "int64"
          }
        }, {
          "name" : "particpantName",
          "in" : "path",
          "required" : true,
          "schema" : {
            "minLength" : 1,
            "type" : "string"
          }
        } ],
        "responses" : {
          "204" : {
            "description" : "Participant deleted successfully"
          },
          "404" : {
            "description" : "Participant not Found"
          },
          "401" : {
            "description" : "Unauthorized"
          },
          "500" : {
            "description" : "Something wrong in Server"
          }
        },
        "security" : [ {
          "basicAuth" : [ ]
        } ]
      }
    },
    "/v1/tournaments" : {
      "get" : {
        "tags" : [ "Tournament Rest Services" ],
        "summary" : "Retrieve all tournaments",
        "description" : "Retrieve all tournaments, can be filtered based on tournamentName and eventName",
        "operationId" : "retrieveAllTournament",
        "parameters" : [ {
          "name" : "Organization-Id",
          "in" : "header",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        }, {
          "name" : "tournamentname",
          "in" : "query",
          "schema" : {
            "maxLength" : 30,
            "minLength" : 0,
            "type" : "string"
          }
        }, {
          "name" : "eventname",
          "in" : "query",
          "schema" : {
            "maxLength" : 30,
            "minLength" : 0,
            "type" : "string"
          }
        }, {
          "name" : "start",
          "in" : "query",
          "schema" : {
            "minimum" : 0,
            "type" : "integer",
            "format" : "int32"
          }
        }, {
          "name" : "size",
          "in" : "query",
          "schema" : {
            "maximum" : 50,
            "minimum" : 0,
            "type" : "integer",
            "format" : "int32"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "Successful operation",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/TournamentResponse"
                }
              },
              "application/xml" : {
                "schema" : {
                  "$ref" : "#/components/schemas/TournamentResponse"
                }
              }
            }
          },
          "404" : {
            "description" : "Not Found"
          },
          "401" : {
            "description" : "Unauthorized"
          },
          "500" : {
            "description" : "Something wrong in Server"
          }
        },
        "security" : [ {
          "basicAuth" : [ ]
        } ]
      },
      "post" : {
        "tags" : [ "Tournament Rest Services" ],
        "summary" : "Create new tournament",
        "operationId" : "createTournament",
        "parameters" : [ {
          "name" : "Organization-Id",
          "in" : "header",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/Tournament"
              }
            },
            "application/xml" : {
              "schema" : {
                "$ref" : "#/components/schemas/Tournament"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "201" : {
            "description" : "Created",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/TournamentResponse"
                }
              },
              "application/xml" : {
                "schema" : {
                  "$ref" : "#/components/schemas/TournamentResponse"
                }
              }
            }
          },
          "400" : {
            "description" : "Invalid tournament",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              },
              "application/xml" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized"
          },
          "500" : {
            "description" : "Something wrong in Server"
          }
        },
        "security" : [ {
          "basicAuth" : [ ]
        } ]
      },
      "delete" : {
        "tags" : [ "Tournament Rest Services" ],
        "summary" : "Delete all tournaments",
        "operationId" : "deleteAllTournament",
        "parameters" : [ {
          "name" : "Organization-Id",
          "in" : "header",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        } ],
        "responses" : {
          "204" : {
            "description" : "All tournaments deleted successfully"
          },
          "404" : {
            "description" : "Tournaments not Found"
          },
          "401" : {
            "description" : "Unauthorized"
          },
          "500" : {
            "description" : "Something wrong in Server"
          }
        },
        "security" : [ {
          "basicAuth" : [ ]
        } ]
      }
    },
    "/v1/tournaments/{tournamentId}" : {
      "get" : {
        "tags" : [ "Tournament Rest Services" ],
        "summary" : "Retrieve tournament by tournament Id",
        "operationId" : "retrieveTournament",
        "parameters" : [ {
          "name" : "Organization-Id",
          "in" : "header",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        }, {
          "name" : "tournamentId",
          "in" : "path",
          "required" : true,
          "schema" : {
            "minimum" : 1,
            "type" : "integer",
            "format" : "int64"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "Successful operation",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/TournamentResponse"
                }
              },
              "application/xml" : {
                "schema" : {
                  "$ref" : "#/components/schemas/TournamentResponse"
                }
              }
            }
          },
          "404" : {
            "description" : "Not Found"
          },
          "401" : {
            "description" : "Unauthorized"
          },
          "500" : {
            "description" : "Something wrong in Server"
          }
        },
        "security" : [ {
          "basicAuth" : [ ]
        } ]
      },
      "put" : {
        "tags" : [ "Tournament Rest Services" ],
        "summary" : "Update tournament by tournament Id",
        "operationId" : "updateTournament",
        "parameters" : [ {
          "name" : "Organization-Id",
          "in" : "header",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        }, {
          "name" : "tournamentId",
          "in" : "path",
          "required" : true,
          "schema" : {
            "minimum" : 1,
            "type" : "integer",
            "format" : "int64"
          }
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/Tournament"
              }
            },
            "application/xml" : {
              "schema" : {
                "$ref" : "#/components/schemas/Tournament"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Successful operation",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/TournamentResponse"
                }
              },
              "application/xml" : {
                "schema" : {
                  "$ref" : "#/components/schemas/TournamentResponse"
                }
              }
            }
          },
          "400" : {
            "description" : "Invalid tournament",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              },
              "application/xml" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404" : {
            "description" : "Not Found"
          },
          "401" : {
            "description" : "Unauthorized"
          },
          "500" : {
            "description" : "Something wrong in Server"
          }
        },
        "security" : [ {
          "basicAuth" : [ ]
        } ]
      },
      "delete" : {
        "tags" : [ "Tournament Rest Services" ],
        "summary" : "Delete tournament by Id",
        "operationId" : "deleteTournament",
        "parameters" : [ {
          "name" : "Organization-Id",
          "in" : "header",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        }, {
          "name" : "tournamentId",
          "in" : "path",
          "required" : true,
          "schema" : {
            "minimum" : 1,
            "type" : "integer",
            "format" : "int64"
          }
        } ],
        "responses" : {
          "204" : {
            "description" : "Tournament deleted successfully"
          },
          "404" : {
            "description" : "Tournament not Found"
          },
          "401" : {
            "description" : "Unauthorized"
          },
          "500" : {
            "description" : "Something wrong in Server"
          }
        },
        "security" : [ {
          "basicAuth" : [ ]
        } ]
      }
    }
  },
  "components" : {
    "schemas" : {
      "BracketResponse" : {
        "type" : "object",
        "properties" : {
          "publicBracketURL" : {
            "type" : "string"
          }
        },
        "xml" : {
          "name" : "bracket"
        }
      },
      "ErrorMessage" : {
        "type" : "object",
        "properties" : {
          "errorMessage" : {
            "type" : "string"
          },
          "errorCode" : {
            "type" : "integer",
            "format" : "int32"
          },
          "documentaion" : {
            "type" : "string"
          }
        }
      },
      "ErrorResponse" : {
        "type" : "object",
        "properties" : {
          "error" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/ErrorMessage"
            }
          }
        },
        "xml" : {
          "name" : "errors"
        }
      },
      "ParticipantResponse" : {
        "type" : "object",
        "properties" : {
          "participants" : {
            "type" : "array",
            "xml" : {
              "name" : "participant"
            },
            "items" : {
              "type" : "string",
              "xml" : {
                "name" : "participant"
              }
            }
          }
        },
        "xml" : {
          "name" : "participants"
        }
      },
      "Tournament" : {
        "required" : [ "bracketType", "eventName", "tournamentName" ],
        "type" : "object",
        "properties" : {
          "tournamentId" : {
            "type" : "integer",
            "format" : "int64",
            "readOnly" : true
          },
          "tournamentName" : {
            "maxLength" : 30,
            "minLength" : 0,
            "type" : "string"
          },
          "eventName" : {
            "maxLength" : 30,
            "minLength" : 0,
            "type" : "string"
          },
          "fieldName" : {
            "maxLength" : 30,
            "minLength" : 0,
            "type" : "string"
          },
          "personInCharge" : {
            "maxLength" : 30,
            "minLength" : 0,
            "type" : "string"
          },
          "commentsNotes" : {
            "maxLength" : 100,
            "minLength" : 0,
            "type" : "string"
          },
          "bracketType" : {
            "minLength" : 1,
            "type" : "string",
            "enum" : [ "BRACKET_TYPE_SINGLE_ELIMINATION", "BRACKET_TYPE_DOUBLE_ELIMINATION", "BRACKET_TYPE_ROUNDROBIN" ]
          },
          "skipConsolationRound" : {
            "type" : "boolean"
          },
          "skipGrandFinalComeback" : {
            "type" : "boolean"
          },
          "skipSecondaryFinal" : {
            "type" : "boolean"
          },
          "randomizeSeeds" : {
            "type" : "boolean"
          }
        }
      },
      "TournamentResponse" : {
        "type" : "object",
        "properties" : {
          "tournaments" : {
            "type" : "array",
            "xml" : {
              "name" : "tournament"
            },
            "items" : {
              "$ref" : "#/components/schemas/Tournament"
            }
          }
        },
        "xml" : {
          "name" : "tournaments"
        }
      }
    },
    "securitySchemes" : {
      "basicAuth" : {
        "type" : "http",
        "scheme" : "basic"
      }
    }
  }
}