# Leaderboard - Match Play

This endpoint is a live web socket endpoint that returns a list of every match in a Match Play Tournament and the current live score / result of this match.

This is to be used in place of [Leaderboard](https://docs.sportradar.com/golf-media/websockets/broken-reference) web socket for match play tournaments.

The authentication token provided will be required to make a connection to this web socket endpoint.

## Endpoint URL

`wss://dde-streams.data.imgarena.com/media/golf/tournaments/{tournamentId}/matchplayleaderboard`

## Process for connecting the web socket endpoints

Same as [Leaderboard](https://docs.sportradar.com/golf-media/websockets/leaderboard)

## Request parameters

Same as [Leaderboard](https://docs.sportradar.com/golf-media/websockets/leaderboard)

### Leaderboard - match play via RestAPI

Note that the matchplay leaderboard websockets is available via Rest - `https://dde-api.data.imgarena.com/media/golf/tournaments/{EventID}/matchplayleaderboard?rest=true`

### Specifications

#### Match Play Leaderboard Object

| Field Name       | Type       | Description                                                                         | Possible Values                                                                        |     |
| ---------------- | ---------- | ----------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | --- |
| tournamentId     | integer    | Unique overall id of the Tournament                                                 | integer                                                                                |     |
| timestamp        | time stamp | Timestamp of message creation                                                       | time stamp                                                                             |     |
| finished         | boolean    | checks if tournament status is official                                             | boolean                                                                                |     |
| seqNum           | integer    | Sequence number of the message                                                      | integer                                                                                |     |
| currentRound     | integer    | Number of the current round. If tournament hasn’t started yet, this value will be 1 | integer                                                                                |     |
| tournamentStatus | string     | Current status of the tournament                                                    | <p>"NotStarted"<br>"InProgress"<br>"PlayComplete" "Official"</p><p>"PlaySuspended"</p> |     |
| roundStatuses    | array      | see object docs                                                                     | NA                                                                                     |     |
| matches          | array      | see object docs                                                                     | NA                                                                                     |     |
| TournamentScores | object     | see object docs                                                                     | NA                                                                                     | YES |

```
{
  "currentRound": 5,
  "finished": true,
  "matches": [** see object below **],
  "roundStatuses": [** see object below **],
  "seqNum": 2306,
  "timestamp": "2023-10-01T15:30:00.845Z",
  "tournamentId": 698,
  "tournamentScores": [** see object below **],
  "tournamentStatus": "Official"
}
```

#### roundStatuses Object

| Field Name | Type    | Description                 | Possible Values                                                                                                                                                |
| ---------- | ------- | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| number     | integer | Number of the round         | integer                                                                                                                                                        |
| status     | string  | Enum value for Round Status | <p>"GroupingsOfficial"</p><p>"InProgress"</p><p>"Maintenance"</p><p>"NotStarted"</p><p>"Official"</p><p>"PlayComplete"</p><p>"Suspended"</p><p>"Cancelled"</p> |

```
 "roundStatuses": [
    {
      "number": 1,
      "status": "Official"
    },
    {
      "number": 2,
      "status": "Official"
    },
    {
      "number": 3,
      "status": "Official"
    },
    {
      "number": 4,
      "status": "Official"
    },
    {
      "number": 5,
      "status": "Official"
    }
  ]
```

#### matches Object

| Field Name        | Type       | Description                                                                                                                                         | Possible Values                                                                                  | Optional |
| ----------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | -------- |
| poolNo            | integer    | Number of the pool for the given match                                                                                                              | integer                                                                                          | YES      |
| courseId          | Integer    | Id of the Course for which the match will be played on                                                                                              | integer                                                                                          |          |
| matchNo           | integer    | <p>The incremental number of the match throughout the Tournament</p><p><strong>N.B.</strong> each <code>matchNo</code> is unique per tournament</p> | integer                                                                                          |          |
| poolMatchPosition | integer    | Match position within the event                                                                                                                     | integer                                                                                          | YES      |
| teams             | array      | see object docs below                                                                                                                               | NA                                                                                               |          |
| roundNo           | integer    | Incremental number of the Round                                                                                                                     | integer                                                                                          |          |
| roundName         | string     | Name of the round                                                                                                                                   | see [**Categorical Fields**](https://docs.sportradar.com/golf-media/websockets/broken-reference) |          |
| matchStatus       | string     | Status of the match                                                                                                                                 | <p>"Not Started"<br>"In Progress"<br>"MatchComplete"</p>                                         |          |
| startHole         | integer    | Hole on which the match started; typically, either 1 or 10                                                                                          | integer                                                                                          |          |
| teeTime           | time stamp | Match’s starting tee time with UTC offset                                                                                                           | time stamp                                                                                       |          |

```
  "matches": [
    {
      "courseId": 2029,
      "matchNo": 1001,
      "matchStatus": "Match Complete",
      "roundName": "Friday Foursomes",
      "roundNo": 1,
      "startHole": 1,
      "teams": [** see object below **],
      "teeTime": "2023-09-29T07:35:00+02:00"
    },
    {
      "courseId": 2029,
      "matchNo": 1002,
      "matchStatus": "Match Complete",
      "roundName": "Friday Foursomes",
      "roundNo": 1,
      "startHole": 1,
      "teams": [** see object below **],
      "teeTime": "2023-09-29T07:50:00+02:00"
    },
    {
      "courseId": 2029,
      "matchNo": 1003,
      "matchStatus": "Match Complete",
      "roundName": "Friday Foursomes",
      "roundNo": 1,
      "startHole": 1,
      "teams": [** see object below **],
      "teeTime": "2023-09-29T08:05:00+02:00"
    }
```

#### teams Object

| Field Name        | Type    | Description                                                                                                | Possible Values                                                                                  | Optional |
| ----------------- | ------- | ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | -------- |
| players           | array   | see object docs                                                                                            | NA                                                                                               |          |
| finaMatchScore    | string  | The player’s final score in the match                                                                      | see [**Categorical Fields**](https://docs.sportradar.com/golf-media/websockets/broken-reference) |          |
| matchLeader       | integer | Indicator of whether or not player is leading in the given match                                           | "1" or "0"                                                                                       |          |
| seed              | integer | Player’s seed at the start of the tournament                                                               | integer                                                                                          | YES      |
| matchWinner       | boolean | Flag indicating whether or not the player is the match winner                                              | "true" or "false"                                                                                |          |
| totalPoolPoints   | decimal | Final sum of points from pool play matches (Number of pool play wins + \[0.5 \* Number of pool play ties]) | decimal                                                                                          | YES      |
| currentMatchScore | string  | The player’s current score in the match                                                                    | see [**Categorical Fields**](https://docs.sportradar.com/golf-media/websockets/broken-reference) |          |
| totalPoolHalves   | integer | Final number of pool play match ties                                                                       | integer                                                                                          | YES      |
| poolPlayGroupNo   | integer | Player’s pool number used in the first 3 rounds (group stage)                                              | integer                                                                                          | YES      |
| totalPoolLosses   | integer | Final number of pool play match losses                                                                     | integer                                                                                          | YES      |
| poolWinner        | boolean | Flag indicating whether or not the player won their pool play                                              | "true" or "false"                                                                                | YES      |
| poolWins          | integer | Current number of pool play match wins                                                                     | integer                                                                                          | YES      |
| teamNo            | integer | Unique number of the Team during the Match Play tournament                                                 | integer                                                                                          |          |
| previousMatch     | integer | Number of the player’s previous match                                                                      | integer ("0" for round 1)                                                                        | YES      |
| thru              | string  | Number of holes played in round                                                                            | integer, "-" or "F" if match is complete                                                         |          |
| isTied            | integer | Flag indicating whether or not the player is tied for their position                                       | "1" or "0"                                                                                       |          |
| poolLosses        | integer | Current number of pool play match losses                                                                   | integer                                                                                          | YES      |
| position          | integer | Player’s numerical ranking in the tournament                                                               | integer                                                                                          | YES      |
| totalPoolWins     | integer | Final number of pool play match wins                                                                       | integer                                                                                          | YES      |
| poolPoints        | decimal | Current sum of points from pool play matches (Number of pool play wins + 0.5 \* Number of pool play ties)  | decimal                                                                                          | YES      |
| poolHalves        | integer | Current number of pool play match ties                                                                     | integer                                                                                          | YES      |

```
"teams": [
        {
          "currentMatchScore": "4up",
          "finalMatchScore": "4 & 3",
          "isTied": 0,
          "matchLeader": 1,
          "matchWinner": true,
          "players": [** see object below **],
          "teamNo": 30,
          "thru": "F"
        },
        {
          "currentMatchScore": "4dn",
          "finalMatchScore": "4 & 3",
          "isTied": 0,
          "matchLeader": 0,
          "matchWinner": false,
          "players": [** see object below **],
          "teamNo": 25,
          "thru": "F"
        }
      ]
```

#### players Object

| Field Name | Type    | Description                            |
| ---------- | ------- | -------------------------------------- |
| id         | integer | Unique id of a Player                  |
| country    | string  | FIFA country code, 3 uppercase letters |
| lastName   | string  | Last known name of the Player          |
| firstName  | string  | First known name of the Player         |

```
 "players": [
            {
              "country": "ESP",
              "firstName": "Jon",
              "id": 493,
              "lastName": "Rahm"
            },
            {
              "country": "ENG",
              "firstName": "Tyrrell",
              "id": 6,
              "lastName": "Hatton"
            }
          ]
```

#### tournamentScores Object

| Field Name     | Type    | Description                                                 | Optional |
| -------------- | ------- | ----------------------------------------------------------- | -------- |
| scoreToWin     | Integer | the score a squad needs to reach in order to win tournament |          |
| host           | boolean | indicates if the squad is hosting the tournament            |          |
| score          | decimal | Total tournament score                                      |          |
| squadName      | string  | name of the squad, either "Europe" or "USA"                 |          |
| SquadNo        | integer | indicator of the squad                                      |          |
| projectedScore | decimal | projected score                                             |          |

```
 "tournamentScores": [
    {
      "host": false,
      "projectedScore": 11.5,
      "score": 11.5,
      "scoreToWin": 14,
      "squadName": "USA",
      "squadNo": 1
    },
    {
      "host": true,
      "projectedScore": 16.5,
      "score": 16.5,
      "scoreToWin": 14.5,
      "squadName": "Europe",
      "squadNo": 2
    }
```

## Categorical Fields

Please find below all possible values and important details for `roundName` , `currentMatchScore` & `finalMatchScore`

| Field Name        | Possible Values                                                                                                                                                                          |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| roundName         | Round1, Round2, Round3, Round of 16, Quarterfinals, Semifinals, Finals, Round for Playoff #1, Friday Foursomes, Friday Fourballs, Saturday Foursomes, Saturday Fourballs, Sunday Singles |
| currentMatchScore | T, 1up, 2up, 3up, 4up, 5up, 6up, 7up, 8up, 9up, 10up, 1dn, 2dn, 3dn, 4dn, 5dn, 6dn, 7dn, 8dn, 9dn, 10dn                                                                                  |

**FinalMatchScore**

The possible values and formats for `finalMatchScore` vary depending on the scenario:

1. Round finishes after 18 holes: possible values are equal to those found in the MatchScore section above (e.g. 1up, 2up)
2. Round finishes after more than 18 holes: the final match score value will read ‘\[number of holes played] HOLES’. For example, if 20 holes are required to declare a winner, then the final match score will read “20 HOLES”
3. Round finishes in less than 18 holes: the final match score value will be of the format “\[difference between player wins and losses] & \[number of holes not played]”. 2 examples below:
   1. Final Match Score of “3 & 1” means that the players ended the round when one player was up by 3 with 1 hole left.
      1. Player A: won 4 holes, lost 1 hole, tied 12 holes -> 17 holes played total
      2. Player B: won 1 hole, lost 4 holes, tied 12 holes -> 17 holes played total
   2. Final Match Score of “5 & 4” means the players ended the round when one player was up by 5 with 4 holes left.
      1. Player A: won 2 holes, lost 7 holes, tied 5 holes -> 14 holes played total
      2. Player B: won 7 holes, lost 2 holes, tied 5 holes -> 14 holes played total
4. Can be "C" if player concedes the match before a ball is struck

## Playoffs

{% hint style="info" %}
No Playoffs in Ryder Cup
{% endhint %}

Two scenarios need to be addressed.

1. Scenario: A play-off match is required to determine the winner of a pool.

Play-off matches will have same format as regular matches in the match score packet, along with unique `matchNo` but will be played in a round with `roundNo` : "301". All play-off matches will appear in this same round. Play-off matches will finish as soon as there is a winner, i.e. if the first hole is tied then a second hole is played etc. until there is a winner. It must also be noted that, in the case of a play-off, a new [schedule](https://docs.sportradar.com/golf-media/websockets/broken-reference) packet will be sent to account for the extra round.

2\. Scenario: There is no winner in a knock out match after 18 holes

Implementation will not be affected other than the fact that more than 18 holes will be played and the `finalMatchScore` will have a different format as detailed in the [Categorical Fields](https://docs.sportradar.com/golf-media/websockets/broken-reference) section.
