# Live Events

This endpoint is to be used in conjunction with the [Team Round Details](https://imghub.atlassian.net/wiki/spaces/PO/pages/389742597/LIVE+WEBSOCKET+API+-+Team+Round+Details) web socket endpoint. You should use the response from this end point to decide which live streams you should connect to. As soon as you see a live stream available on this endpoint you should commence connecting to the web socket for that individual live stream event (I.e a Team playing a Round of Golf).

Per each live event, the endpoint will return the following information:

* Name of the live tournament
* Round number of the live tournament
* Start time and status of the live tournament
* Group and team identification number (also match identifier for match play and Ryder Cup)
* Detailed information of the player
* Entry type of each player

## Endpoint URL

Endpoint for all live tournaments:

`https://dde-api.data.imgarena.com/golf/tournaments/liveevents`

## Required Headers

| Key           | Value                                            |
| ------------- | ------------------------------------------------ |
| Accept        | application/vnd.imggaming.dde.api+json;version=1 |
| Content-Type  | application/json                                 |
| Authorization | Bearer eyvhaoudfgpdfgo\*                         |

\*Authorization header includes a truncated Bearer token, contact IMG for your auth token if you do not have.

## Request Parameters

This endpoint takes no request parameters.

## Response Model

\
**Live Events Object**

| Field Name     | Type    | Description                                                                                                 |
| -------------- | ------- | ----------------------------------------------------------------------------------------------------------- |
| tournamentId   | int     | The unique id of the tournament                                                                             |
| tournamentName | string  | The name of the tournament                                                                                  |
| roundNo        | integer | The number of the round                                                                                     |
| startTime      | object  | See object below                                                                                            |
| Group          | object  | See object below                                                                                            |
| matchNo        | integer | \[Optional] will only be available for match play and Ryder Cup formats in which case `matchNo` = `groupNo` |

```
{
  "group": {
    "featureGroup": false,
    "groupNo": 1,
    "matchNo": null,
    "teams": [
      {
        "orderOfPlayWithinGroup": 0,
        "players": [
          {
            "country": "ESP",
            "displayName": "Nacho Elvira",
            "firstName": "Nacho",
            "isAmateur": false,
            "lastName": "Elvira",
            "playerEuropeanTourId": "36078",
            "playerId": 141,
            "playerLPGATourId": null,
            "playerPGATourId": "39201",
            "playerRandAId": "152165",
            "status": "Entered"
          }
        ],
        "teamNo": 64
      },
      {
        "orderOfPlayWithinGroup": 1,
        "players": [
          {
            "country": "ENG",
            "displayName": "Oliver Fisher",
            "firstName": "Oliver",
            "isAmateur": false,
            "lastName": "Fisher",
            "playerEuropeanTourId": "34653",
            "playerId": 55,
            "playerLPGATourId": null,
            "playerPGATourId": null,
            "playerRandAId": null,
            "status": "Entered"
          }
        ],
        "teamNo": 94
      },
      {
        "orderOfPlayWithinGroup": 2,
        "players": [
          {
            "country": "ENG",
            "displayName": "Ross Fisher",
            "firstName": "Ross",
            "isAmateur": false,
            "lastName": "Fisher",
            "playerEuropeanTourId": "32435",
            "playerId": 146,
            "playerLPGATourId": null,
            "playerPGATourId": "27896",
            "playerRandAId": null,
            "status": "Entered"
          }
        ],
        "teamNo": 77
      }
    ]
  },
  "roundNo": 1,
  "startTime": {
    "status": "StartsAt",
    "time": "09:00Z"
  },
  "tournamentId": 3052,
  "tournamentName": "BMW PGA Simulation 519"
}
```

\
**Start Time Object**

| Field Name | Type   | Description                                           |
| ---------- | ------ | ----------------------------------------------------- |
| status     | string | The status of the start time – e.g. ‘StartsAt’        |
| time       | date   | The time the group are scheduled to start their round |

```
"startTime": {
    "status": "StartsAt",
    "time": "09:00Z"
  }
```

**Group Object**

| Field Name   | Type    | Description                                                                                                 |
| ------------ | ------- | ----------------------------------------------------------------------------------------------------------- |
| featureGroup | boolean | Returns true if the group is a featured group                                                               |
| groupNo      | integer | The official group’s number, an identifier for the group within the round and course.                       |
| teams        | object  | See object docs                                                                                             |
| matchNo      | integer | \[Optional] will only be available for match play and Ryder Cup formats in which case `matchNo` = `groupNo` |

```
  "group": {
    "featureGroup": false,
    "groupNo": 1,
    "matchNo": null,
    "teams": [
      {
        "orderOfPlayWithinGroup": 0,
        "players": [
          {
            "country": "ESP",
            "displayName": "Nacho Elvira",
            "firstName": "Nacho",
            "isAmateur": false,
            "lastName": "Elvira",
            "playerEuropeanTourId": "36078",
            "playerId": 141,
            "playerLPGATourId": null,
            "playerPGATourId": "39201",
            "playerRandAId": "152165",
            "status": "Entered"
          }
        ],
        "teamNo": 64
      },
      {
        "orderOfPlayWithinGroup": 1,
        "players": [
          {
            "country": "ENG",
            "displayName": "Oliver Fisher",
            "firstName": "Oliver",
            "isAmateur": false,
            "lastName": "Fisher",
            "playerEuropeanTourId": "34653",
            "playerId": 55,
            "playerLPGATourId": null,
            "playerPGATourId": null,
            "playerRandAId": null,
            "status": "Entered"
          }
        ],
        "teamNo": 94
      },
      {
        "orderOfPlayWithinGroup": 2,
        "players": [
          {
            "country": "ENG",
            "displayName": "Ross Fisher",
            "firstName": "Ross",
            "isAmateur": false,
            "lastName": "Fisher",
            "playerEuropeanTourId": "32435",
            "playerId": 146,
            "playerLPGATourId": null,
            "playerPGATourId": "27896",
            "playerRandAId": null,
            "status": "Entered"
          }
        ],
        "teamNo": 77
      }
    ]
```

\
**Teams and Players Object**

There are typically only 2 or 3 teams in a Groups - but below is an example of 4.

| Field Name             | Type    | Description                                            |
| ---------------------- | ------- | ------------------------------------------------------ |
| orderOfPlayWithinGroup | integer | Order of play of the player. 0 meaning they are first. |
| players                | object  | See object below                                       |
| teamNo                 | integer | teamNo of the player                                   |

```
 "teams": [
      {
        "orderOfPlayWithinGroup": 0,
        "players": [
          {
            "country": "ESP",
            "displayName": "Nacho Elvira",
            "firstName": "Nacho",
            "isAmateur": false,
            "lastName": "Elvira",
            "playerEuropeanTourId": "36078",
            "playerId": 141,
            "playerLPGATourId": null,
            "playerPGATourId": "39201",
            "playerRandAId": "152165",
            "status": "Entered"
          }
        ],
        "teamNo": 64
      },
      {
        "orderOfPlayWithinGroup": 1,
        "players": [
          {
            "country": "ENG",
            "displayName": "Oliver Fisher",
            "firstName": "Oliver",
            "isAmateur": false,
            "lastName": "Fisher",
            "playerEuropeanTourId": "34653",
            "playerId": 55,
            "playerLPGATourId": null,
            "playerPGATourId": null,
            "playerRandAId": null,
            "status": "Entered"
          }
        ],
        "teamNo": 94
      },
      {
        "orderOfPlayWithinGroup": 2,
        "players": [
          {
            "country": "ENG",
            "displayName": "Ross Fisher",
            "firstName": "Ross",
            "isAmateur": false,
            "lastName": "Fisher",
            "playerEuropeanTourId": "32435",
            "playerId": 146,
            "playerLPGATourId": null,
            "playerPGATourId": "27896",
            "playerRandAId": null,
            "status": "Entered"
          }
        ],
        "teamNo": 77
      }
    ]
```

\
**Players Object**

| Field Name           | Type    | Description                                                                                                                        |
| -------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| playerId             | integer | The ID of the player                                                                                                               |
| displayName          | string  | The display name of the player                                                                                                     |
| playerPGATourId      | integer | The PGA Tour Id of the player where applicable                                                                                     |
| playerEuropeanTourId | integer | The European Tour Id of the player where applicable                                                                                |
| playerLPGATourId     | integer | The LPGA Tour Id of the player where applicable                                                                                    |
| playerRandAId        | integer | Players R\&A Id (if relevant)                                                                                                      |
| firstName            | string  | The first name of the player                                                                                                       |
| lastName             | string  | The last name of the player                                                                                                        |
| country              | string  | The country code of the player’s country                                                                                           |
| isAmateur            | boolean | Is the player an amateur or not                                                                                                    |
| status               | string  | Players' status, one of the following: Entered, Alternate, Playing, Withdrawn, Retired, Disqualified, MissedCut, Removed, Unknown. |

## **Sample Code**

```
[
    {
        "tournamentId": 727,
        "startTime": {
            "status": "StartsAt",
            "time": "15:15Z"
        },
        "roundNo": 2,
        "tournamentName": "Butterfield Bermuda Championship",
        "group": {
            "groupNo": 11,
            "teams": [
                {
                    "teamNo": 22,
                    "players": [
                        {
                            "displayName": "Chris Stroud",
                            "playerPGATourId": "27963",
                            "playerEuropeanTourId": null,
                            "country": "USA",
                            "isAmateur": false,
                            "lastName": "Stroud",
                            "firstName": "Chris",
                            "status": "Entered",
                            "playerId": 2217,
                            "playerLPGATourId": null
                        }
                    ],
                    "orderOfPlayWithinGroup": 0
                },
                {
                    "teamNo": 66,
                    "players": [
                        {
                            "displayName": "Adam Hadwin",
                            "playerPGATourId": "33399",
                            "playerEuropeanTourId": "38066",
                            "country": "CAN",
                            "isAmateur": false,
                            "lastName": "Hadwin",
                            "firstName": "Adam",
                            "status": "Entered",
                            "playerId": 2205,
                            "playerLPGATourId": null
                        }
                    ],
                    "orderOfPlayWithinGroup": 1
                },
                {
                    "teamNo": 9,
                    "players": [
                        {
                            "displayName": "Matt Every",
                            "playerPGATourId": "28307",
                            "playerEuropeanTourId": null,
                            "country": "USA",
                            "isAmateur": false,
                            "lastName": "Every",
                            "firstName": "Matt",
                            "status": "Entered",
                            "playerId": 2289,
                            "playerLPGATourId": null
                        }
                    ],
                    "orderOfPlayWithinGroup": 2
                }
            ],
            "matchNo": null
        }
    }
]
```
