# Documentation

## Query Debaters

<mark style="color:blue;">`GET`</mark> `URL: https://tournaments.tech/query`

Search for a debater/entry within a specified format, year, and circuit.

#### Query Parameters

| Name                                      | Type   | Description                                                                                                                                                                 |
| ----------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| format<mark style="color:red;">\*</mark>  | String | A recognized debate format (see API Constants & Schemas for more).                                                                                                          |
| circuit<mark style="color:red;">\*</mark> | String | A recognized debate circuit for the specified format (see API Constants & Schemas for more).                                                                                |
| year<mark style="color:red;">\*</mark>    | String | A recognized debate year for the specified circuit (see API Constants & Schemas for more).                                                                                  |
| team                                      | String | An ID (see API Constants & Schemas for more) of a specific team that exists on the supplied format, circuit, and year. If provided, you'll only recieve data for that team. |
| term                                      | String | The term to query against the specified format, circuit, and year. Can be any combination of the entry's full names or any of the entry's codes.                            |

{% tabs %}
{% tab title="400: Bad Request Sent if you fail to provide valid information for all required query parameters or if you provide both a term and a team or neither a term or team." %}

```javascript
Invalid Query
```

{% endtab %}

{% tab title="500: Internal Server Error Sent when an unexpected error is encountered. A message is provided that includes what went wrong." %}

```javascript
{
    "message": <(String) error message>
}
```

{% endtab %}

{% tab title="200: OK An array of teams is returned if you queried using term." %}

```javascript
[<(Schemas.Team)>...]
```

{% endtab %}
{% endtabs %}

## Stable URL For Debaters

<mark style="color:blue;">`GET`</mark> `URL: https://tournaments.tech/stable/:fullNames`

A stable URL that can be safely linked in College Apps, etc. which will redirect to the team's latest page for the specified format, circuit, and year.

#### Path Parameters

| Name                                        | Type   | Description                                               |
| ------------------------------------------- | ------ | --------------------------------------------------------- |
| fullNames<mark style="color:red;">\*</mark> | String | The full names (URL safe) of the debater(s) of the entry. |

#### Query Parameters

| Name                                      | Type    | Description                                                                                                                                    |
| ----------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| format<mark style="color:red;">\*</mark>  | String  | A recognized debate format (see API Constants & Schemas for more).                                                                             |
| circuit<mark style="color:red;">\*</mark> | String  | A recognized debate circuit for the specified format (see API Constants & Schemas for more).                                                   |
| year<mark style="color:red;">\*</mark>    | String  | A recognized debate year for the specified circuit (see API Constants & Schemas for more).                                                     |
| api                                       | Boolean | Whether to provide an API-style response (the currentURL as a String) or human-style response (redirect to the currentURL). Defaults to False. |

{% tabs %}
{% tab title="400: Bad Request Sent if you fail to provide valid information for all required query parameters." %}

```javascript
Invalid Query
```

{% endtab %}

{% tab title="500: Internal Server Error Sent when an unexpected error is encountered. A message is provided that includes what went wrong." %}

```javascript
{
    "message": <(String) error message>
}
```

{% endtab %}

{% tab title="200: OK A redirect is sent if Query.api is False to the currentURL." %}

```javascript
{
    "goTo": <(String) current url>
}
```

{% endtab %}

{% tab title="200: OK The currentURL is sent if Query.api is True." %}

```javascript
{
    "currentURL": <(String) current url>
}
```

{% endtab %}
{% endtabs %}

## Get Leaders

<mark style="color:blue;">`GET`</mark> `URL: https://tournaments.tech/leaders`

Get a leaderboard for a specified format, circuit, and year. Uses the OTR Score to generate leaders.

#### Query Parameters

| Name                                      | Type   | Description                                                                                  |
| ----------------------------------------- | ------ | -------------------------------------------------------------------------------------------- |
| format<mark style="color:red;">\*</mark>  | String | A recognized debate format (see API Constants & Schemas for more).                           |
| circuit<mark style="color:red;">\*</mark> | String | A recognized debate circuit for the specified format (see API Constants & Schemas for more). |
| year<mark style="color:red;">\*</mark>    | String | A recognized debate year for the specified circuit (see API Constants & Schemas for more).   |

{% tabs %}
{% tab title="400: Bad Request Sent if you fail to provide valid information for all required query parameters." %}

```javascript
Invalid Query
```

{% endtab %}

{% tab title="500: Internal Server Error Sent when an unexpected error is encountered. A message is provided that includes what went wrong." %}

```javascript
{
    "message": <(String) error message>
}
```

{% endtab %}

{% tab title="200: OK An array of teams is returned in order of highest to lowest ranked." %}

```javascript
[<(Schemas.Team)>...]
```

{% endtab %}
{% endtabs %}
