# Match Score - Match Play

This is a live websocket endpoint that returns hole by hole scores for a match. The whole json is sent whenever there is an update. You should receive a new update when a hole is completed.

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

This web socket is the match play equivalent to Team Hole by Hole Score web socket for stroke play.

## Endpoint URL

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

## Process for connecting the web socket endpoints

Same as [Team Hole-by-Hole Score](https://docs.sportradar.com/golf-media/websockets/team-hole-by-hole-score)

## Request parameters

Same as [Team Hole-by-Hole Score](https://docs.sportradar.com/golf-media/websockets/team-hole-by-hole-score)

### Match Score - match play via RestAPI

Note that the Match score websockets is available via Rest - `https://dde-api.data.imgarena.com/media/golf/tournaments/{tournamentId}/matchscore/{MatchNo}?rest=true`

## Response Model

#### Match Play Match score Object

| Field Name    | Type    | Description                                                                                                                                                                                    | OPTIONAL |
| ------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| tournamentId  | integer | tournament identifier                                                                                                                                                                          |          |
| timestamp     | time    | Time at which the scorecard feed was generated in UTC                                                                                                                                          |          |
| teamScores    | array   | see object docs                                                                                                                                                                                |          |
| isOfficial    | boolean | Indicates whether or not the scorecard updates for the given player are complete. Occurs when a player has completed competing in the tournament either from retiring or finishing all rounds. |          |
| seqNum        | integer | sequence number of the packet                                                                                                                                                                  |          |
| scoringType   | string  | \[Optional] is either "strokes" or "points"                                                                                                                                                    | YES      |
| winningTeamNo | integer | identifier of the match winner; will be null until a winner is defined                                                                                                                         | YES      |
| matchId       | integer | match identifier                                                                                                                                                                               |          |

```
{
  "isOfficial": false,
  "matchId": 5012,
  "scoringType": "Points",
  "seqNum": 1,
  "teamScores": [** see object below **],
  "timestamp": "2023-10-01T11:46:56.504Z",
  "tournamentId": 698,
  "winningTeamNo": null
}
```

#### teamScores object

| Field Name      | Type    | Description                                                                                                                                            | Optional |
| --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
| matchTotalToPar | integer | \[Optional] Integer, Score to par calculated for finished holes                                                                                        | YES      |
| players         | array   | see object docs                                                                                                                                        |          |
| matchPoints     | Decimal | \[Optional] Decimal, Score for team in match, usually it will be sum of points of MatchHoleScore points (available only for ScoringType set to Points) | YES      |
| matchStrokes    | integer | \[Optional] Integer, Number of strokes taken in that match - based only on completed holes                                                             | YES      |
| holeScores      | array   | see object docs                                                                                                                                        |          |
| teamNo          | integer | Team identifier                                                                                                                                        |          |

```
"teamScores": [
    {
      "holeScores": [** see object below **],
      "matchPoints": 9.5,
      "matchStrokes": 60,
      "matchTotalToPar": -2,
      "players": [** see object below **],
      "teamNo": 18,
      "teamResult": "Won"
    },
    {
      "holeScores": [** see object below **],
      "matchPoints": 7.5,
      "matchStrokes": 61,
      "matchTotalToPar": -1,
      "players": [** see object below **],
      "teamNo": 11,
      "teamResult": "Lost"
    }
    
    
```

#### holescores object

| Field Name               | Type    | Description                                                                                                                                                                                                                  | Optional |
| ------------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| cumulativeScoreToPar     | integer | \[Optional] Integer, Contains cumulative number of strokes compared to par of current and previous holes                                                                                                                     | YES      |
| yardage                  | integer | The length of the hole in yards                                                                                                                                                                                              |          |
| par                      | integer | Par value for the given hole                                                                                                                                                                                                 |          |
| holeFinished             | boolean | flag to determine if a given hole is finished                                                                                                                                                                                |          |
| scoreToPar               | integer | \[Optional] integer, score to par on particular hole. This value will be empty when hole was not played yet or conceded                                                                                                      | YES      |
| points                   | double  | The accumulated points score for that match                                                                                                                                                                                  | YES      |
| holeFinishedBy           | string  | <p>The reason for which the hole ended; possible values:</p><p>"BallHoled"<br>"HoleWon"<br>"LossOfHole"<br>"HoleConceded"</p><p>See <a href="broken-reference"><strong>supplementary information</strong></a></p>            | YES      |
| cumulativeHolesAdvantage | string  | The team’s score in the match at the time that the given hole was completed, see [**categorical fields**](https://docs.sportradar.com/golf-media/websockets/broken-reference)                                                | YES      |
| strokes                  | string  | Number of strokes taken for the given hole; if a hole is conceded, the strokes value is set to "c", can also be "-". see [**supplementary information**](https://docs.sportradar.com/golf-media/websockets/broken-reference) | YES      |
| holeNo                   | integer | Number of the hole                                                                                                                                                                                                           |          |
| playOffSequence          | integer | A counter indicating which playoff hole number the given hole pertains to, Will be 0 for non-playoff holes, and will count up from 1 for playoff holes                                                                       |          |
| PlayerScores             | array   | Score per player on a given hole, this will be sent when teams are playing best ball (Four Balls) format so as to know the individual player score as well as the total team score                                           | YES      |

```
{
      "holeScores": [
        {
          "cumulativeHolesAdvantage": "T",
          "cumulativeScoreToPar": 0,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 1,
          "par": 4,
          "playOffSequence": 0,
          "points": 0.5,
          "scoreToPar": 0,
          "strokes": "4",
          "yardage": 407
        },
        {
          "cumulativeHolesAdvantage": "1up",
          "cumulativeScoreToPar": 0,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 2,
          "par": 4,
          "playOffSequence": 0,
          "points": 1,
          "scoreToPar": 0,
          "strokes": "4",
          "yardage": 463
        },
        {
          "cumulativeHolesAdvantage": "1up",
          "cumulativeScoreToPar": 0,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 3,
          "par": 4,
          "playOffSequence": 0,
          "points": 0.5,
          "scoreToPar": 0,
          "strokes": "4",
          "yardage": 414
        },
```

#### players object

| **Field Name** | Type    | Description                    |
| -------------- | ------- | ------------------------------ |
| displayName    | string  | Name of the player             |
| country        | string  | Country (3 upper case letters) |
| isAmateur      | boolean | True if player is an amateur   |
| lastName       | string  | Last name                      |
| firstName      | string  | First name                     |
| id             | integer | Player ID                      |
| gender         | string  | gender of the player           |

```
"players": [
        {
          "country": "SCO",
          "": "Robert MacIntyre",
          "firstName": "Robert",
          "gender": "male",
          "id": 209,
          "isAmateur": false,
          "lastName": "MacIntyre"
        }
      ],
```

#### PlayerScores Object

| Field       | Type    | Description                                | Optional |
| ----------- | ------- | ------------------------------------------ | -------- |
| Strokes     | integer | number of strokes on a given hole          |          |
| ScoreToPar  | integer | score to par on a given hole               |          |
| id          | integer | player ID                                  |          |
| isBallHoled | Boolean | Flag indicating whether the ball was holed |          |

## Ryder Cup Example

```
{
  "isOfficial": true,
  "matchId": 5012,
  "scoringType": "Points",
  "seqNum": 68,
  "teamScores": [
    {
      "holeScores": [
        {
          "cumulativeHolesAdvantage": "T",
          "cumulativeScoreToPar": 0,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 1,
          "par": 4,
          "playOffSequence": 0,
          "points": 0.5,
          "scoreToPar": 0,
          "strokes": "4",
          "yardage": 407
        },
        {
          "cumulativeHolesAdvantage": "1up",
          "cumulativeScoreToPar": 0,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 2,
          "par": 4,
          "playOffSequence": 0,
          "points": 1,
          "scoreToPar": 0,
          "strokes": "4",
          "yardage": 463
        },
        {
          "cumulativeHolesAdvantage": "1up",
          "cumulativeScoreToPar": 0,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 3,
          "par": 4,
          "playOffSequence": 0,
          "points": 0.5,
          "scoreToPar": 0,
          "strokes": "4",
          "yardage": 414
        },
        {
          "cumulativeHolesAdvantage": "2up",
          "cumulativeScoreToPar": -1,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 4,
          "par": 3,
          "playOffSequence": 0,
          "points": 1,
          "scoreToPar": -1,
          "strokes": "2",
          "yardage": 172
        },
        {
          "cumulativeHolesAdvantage": "3up",
          "cumulativeScoreToPar": -2,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 5,
          "par": 4,
          "playOffSequence": 0,
          "points": 1,
          "scoreToPar": -1,
          "strokes": "3",
          "yardage": 276
        },
        {
          "cumulativeHolesAdvantage": "3up",
          "cumulativeScoreToPar": -3,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 6,
          "par": 4,
          "playOffSequence": 0,
          "points": 0.5,
          "scoreToPar": -1,
          "strokes": "3",
          "yardage": 348
        },
        {
          "cumulativeHolesAdvantage": "3up",
          "cumulativeScoreToPar": -3,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 7,
          "par": 3,
          "playOffSequence": 0,
          "points": 0.5,
          "scoreToPar": 0,
          "strokes": "3",
          "yardage": 203
        },
        {
          "cumulativeHolesAdvantage": "2up",
          "cumulativeScoreToPar": -2,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 8,
          "par": 4,
          "playOffSequence": 0,
          "points": 0,
          "scoreToPar": 1,
          "strokes": "5",
          "yardage": 480
        },
        {
          "cumulativeHolesAdvantage": "2up",
          "cumulativeScoreToPar": -2,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 9,
          "par": 5,
          "playOffSequence": 0,
          "points": 0.5,
          "scoreToPar": 0,
          "strokes": "5",
          "yardage": 537
        },
        {
          "cumulativeHolesAdvantage": "1up",
          "cumulativeScoreToPar": -2,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 10,
          "par": 4,
          "playOffSequence": 0,
          "points": 0,
          "scoreToPar": 0,
          "strokes": "4",
          "yardage": 414
        },
        {
          "cumulativeHolesAdvantage": "2up",
          "cumulativeScoreToPar": -3,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 11,
          "par": 4,
          "playOffSequence": 0,
          "points": 1,
          "scoreToPar": -1,
          "strokes": "3",
          "yardage": 301
        },
        {
          "cumulativeHolesAdvantage": "2up",
          "cumulativeScoreToPar": -3,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 12,
          "par": 5,
          "playOffSequence": 0,
          "points": 0.5,
          "scoreToPar": 0,
          "strokes": "5",
          "yardage": 499
        },
        {
          "cumulativeHolesAdvantage": "1up",
          "cumulativeScoreToPar": -3,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 13,
          "par": 3,
          "playOffSequence": 0,
          "points": 0,
          "scoreToPar": 0,
          "strokes": "3",
          "yardage": 137
        },
        {
          "cumulativeHolesAdvantage": "T",
          "cumulativeScoreToPar": -2,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 14,
          "par": 4,
          "playOffSequence": 0,
          "points": 0,
          "scoreToPar": 1,
          "strokes": "5",
          "yardage": 465
        },
        {
          "cumulativeHolesAdvantage": "1up",
          "cumulativeScoreToPar": -2,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 15,
          "par": 4,
          "playOffSequence": 0,
          "points": 1,
          "scoreToPar": 0,
          "strokes": "4",
          "yardage": 438
        },
        {
          "cumulativeHolesAdvantage": "2up",
          "holeFinished": true,
          "holeFinishedBy": "HoleWon",
          "holeNo": 16,
          "par": 4,
          "playOffSequence": 0,
          "points": 1,
          "strokes": "-",
          "yardage": 277
        },
        {
          "cumulativeHolesAdvantage": "2up",
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 17,
          "par": 3,
          "playOffSequence": 0,
          "points": 0.5,
          "scoreToPar": 0,
          "strokes": "3",
          "yardage": 188
        },
        {
          "holeFinished": false,
          "holeNo": 18,
          "par": 5,
          "playOffSequence": 0,
          "yardage": 546
        }
      ],
      "matchPoints": 9.5,
      "matchStrokes": 60,
      "matchTotalToPar": -2,
      "players": [
        {
          "country": "SCO",
          "displayName": "Robert MacIntyre",
          "firstName": "Robert",
          "gender": "male",
          "id": 209,
          "isAmateur": false,
          "lastName": "MacIntyre"
        }
      ],
      "teamNo": 18,
      "teamResult": "Won"
    },
    {
      "holeScores": [
        {
          "cumulativeHolesAdvantage": "T",
          "cumulativeScoreToPar": 0,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 1,
          "par": 4,
          "playOffSequence": 0,
          "points": 0.5,
          "scoreToPar": 0,
          "strokes": "4",
          "yardage": 407
        },
        {
          "cumulativeHolesAdvantage": "1dn",
          "cumulativeScoreToPar": 1,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 2,
          "par": 4,
          "playOffSequence": 0,
          "points": 0,
          "scoreToPar": 1,
          "strokes": "5",
          "yardage": 463
        },
        {
          "cumulativeHolesAdvantage": "1dn",
          "cumulativeScoreToPar": 1,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 3,
          "par": 4,
          "playOffSequence": 0,
          "points": 0.5,
          "scoreToPar": 0,
          "strokes": "4",
          "yardage": 414
        },
        {
          "cumulativeHolesAdvantage": "2dn",
          "cumulativeScoreToPar": 1,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 4,
          "par": 3,
          "playOffSequence": 0,
          "points": 0,
          "scoreToPar": 0,
          "strokes": "3",
          "yardage": 172
        },
        {
          "cumulativeHolesAdvantage": "3dn",
          "cumulativeScoreToPar": 1,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 5,
          "par": 4,
          "playOffSequence": 0,
          "points": 0,
          "scoreToPar": 0,
          "strokes": "4",
          "yardage": 276
        },
        {
          "cumulativeHolesAdvantage": "3dn",
          "cumulativeScoreToPar": 0,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 6,
          "par": 4,
          "playOffSequence": 0,
          "points": 0.5,
          "scoreToPar": -1,
          "strokes": "3",
          "yardage": 348
        },
        {
          "cumulativeHolesAdvantage": "3dn",
          "cumulativeScoreToPar": 0,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 7,
          "par": 3,
          "playOffSequence": 0,
          "points": 0.5,
          "scoreToPar": 0,
          "strokes": "3",
          "yardage": 203
        },
        {
          "cumulativeHolesAdvantage": "2dn",
          "cumulativeScoreToPar": 0,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 8,
          "par": 4,
          "playOffSequence": 0,
          "points": 1,
          "scoreToPar": 0,
          "strokes": "4",
          "yardage": 480
        },
        {
          "cumulativeHolesAdvantage": "2dn",
          "cumulativeScoreToPar": 0,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 9,
          "par": 5,
          "playOffSequence": 0,
          "points": 0.5,
          "scoreToPar": 0,
          "strokes": "5",
          "yardage": 537
        },
        {
          "cumulativeHolesAdvantage": "1dn",
          "cumulativeScoreToPar": -1,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 10,
          "par": 4,
          "playOffSequence": 0,
          "points": 1,
          "scoreToPar": -1,
          "strokes": "3",
          "yardage": 414
        },
        {
          "cumulativeHolesAdvantage": "2dn",
          "cumulativeScoreToPar": -1,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 11,
          "par": 4,
          "playOffSequence": 0,
          "points": 0,
          "scoreToPar": 0,
          "strokes": "4",
          "yardage": 301
        },
        {
          "cumulativeHolesAdvantage": "2dn",
          "cumulativeScoreToPar": -1,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 12,
          "par": 5,
          "playOffSequence": 0,
          "points": 0.5,
          "scoreToPar": 0,
          "strokes": "5",
          "yardage": 499
        },
        {
          "cumulativeHolesAdvantage": "1dn",
          "cumulativeScoreToPar": -2,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 13,
          "par": 3,
          "playOffSequence": 0,
          "points": 1,
          "scoreToPar": -1,
          "strokes": "2",
          "yardage": 137
        },
        {
          "cumulativeHolesAdvantage": "T",
          "cumulativeScoreToPar": -2,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 14,
          "par": 4,
          "playOffSequence": 0,
          "points": 1,
          "scoreToPar": 0,
          "strokes": "4",
          "yardage": 465
        },
        {
          "cumulativeHolesAdvantage": "1dn",
          "cumulativeScoreToPar": -1,
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 15,
          "par": 4,
          "playOffSequence": 0,
          "points": 0,
          "scoreToPar": 1,
          "strokes": "5",
          "yardage": 438
        },
        {
          "cumulativeHolesAdvantage": "2dn",
          "holeFinished": true,
          "holeFinishedBy": "HoleConceded",
          "holeNo": 16,
          "par": 4,
          "playOffSequence": 0,
          "points": 0,
          "strokes": "c",
          "yardage": 277
        },
        {
          "cumulativeHolesAdvantage": "2dn",
          "holeFinished": true,
          "holeFinishedBy": "BallHoled",
          "holeNo": 17,
          "par": 3,
          "playOffSequence": 0,
          "points": 0.5,
          "scoreToPar": 0,
          "strokes": "3",
          "yardage": 188
        },
        {
          "holeFinished": false,
          "holeNo": 18,
          "par": 5,
          "playOffSequence": 0,
          "yardage": 546
        }
      ],
      "matchPoints": 7.5,
      "matchStrokes": 61,
      "matchTotalToPar": -1,
      "players": [
        {
          "country": "USA",
          "displayName": "Wyndham Clark",
          "firstName": "Wyndham",
          "gender": "male",
          "id": 3425,
          "isAmateur": false,
          "lastName": "Clark"
        }
      ],
      "teamNo": 11,
      "teamResult": "Lost"
    }
  ],
  "timestamp": "2023-10-01T15:21:32.866Z",
  "tournamentId": 698,
  "winningTeamNo": 18
}
```

## Categorical Fields

Please find below all possible values for `cumulativeHolesAdvantage`

## Supplementary information

#### Holescores.Strokes

holescores.strokes field is a string and indicates the number of strokes taken for the given hole. Possible values are any valid integer, as well as "c" and "-" .

Scenarios

* Team holes the ball - strokes value will be an integer
* Team concedes hole - strokes value will be "c"
* Team wins hole but does not hole the ball - strokes value will be "-"
* Team loses hole without conceding the hole or holing the ball - strokes value will be "-"

\*For more information you can refer to holeScores.holeFinishedBy field (details below.)

#### HoleScores.playerScores.strokes

HoleScores.playerScores.strokes field is an integer and indicates the number of strokes a **player** had on a hole during a fourball format match (aka better ball.)

To be clear, the overarching score for the **team** will be taken from Holescores object, but we suggest drilling down to HoleScores.playerScores object for UI implementations as this information is important to the end user.

Suggested business logic for fourballs (aka better ball):

GIVEN fourballs scorecard\
WHEN `holeScores.HoleFinishedBy` is "HoleConceded" for a team\
THEN display "c" for both players' strokes score on the scorecard for that team

GIVEN fourballs scorecard\
WHEN `holeScores.HoleFinishedBy` is "LossOfHole" for a team\
THEN display "-" for both players' strokes score on the scorecard for that team

GIVEN fourballs scorecard\
WHEN `holeScores.HoleFinishedBy` is "HoleWon" for a team\
THEN display "-" for both players strokes score on the scorecard for that team

GIVEN fourballs scorecard\
WHEN `holeScores.HoleFinishedBy` is "BallHoled" for a team\
THEN display `playerScores.strokes` IF "playerScores.isBallHoled" : "true"\
AND display "-" IF "playerScores.isBallHoled" : "false"

{% hint style="info" %}
N.B. currently do not support 'gimmes' i.e. if a player is given a concession stroke from the other player it will go down as a successful stroke or "ballHoled".

For example, player A has 2 inches to make a par putt on a par 3 and player B says to the player to pick up his ball and take a 'gimme' it will go down as 3 strokes and "holeFinishedBy" as "BallHoled".
{% endhint %}

## Play-Offs

{% 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 match score packet format as regular matches, along with unique `matchNo`. 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.

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

In the case of a match not being settled in 18 holes, extra holes will be played until there is a winner. The client can determine when to use play-off logic based on the `playOfSequence` field which will be "1" in the case of an extra play-off hole.

##
