# Match Event Data (SPS) API

This endpoint returns an entire Soccer match event data session in the form of sequential timestamped packets covering an IMGA/Openbet Sports Services (SPS) collected match. The endpoint can be filtered by the specific fixtureId for that match and returns each phase of the match action along with the connected events around each event.

Key information within the response is as follows:

* Fixture ID
* Player Details, including shirt number
* Action type
* Clock time
* Action Context and MetaData, such as Goals, Fouls, Assists
* Period (1st or 2nd Half)
* XY coordinate position of player and match event
* Parent Action ID, to enable linking preceding events
* Team name and details
* VAR Decisions and Player Substitutions

## Endpoint URLs

**`Still to be confirmed, likely to be in the form of below:`**

**`https://dde-api.data.imgarena.com/soccer/fixture/{fixture_id}/events`**

## Polling Frequency <a href="#undefined" id="undefined"></a>

We recommend the following frequency for your REST requests to ensure that you have the most up-to-date information at all times:<br>

<table><thead><tr><th width="155">Frequency</th></tr></thead><tbody><tr><td>Every 30 seconds for media usage</td></tr></tbody></table>

## 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 currently takes a **fixture\_id** in the url header to fetch the correct fixture.

## Response Model

\
**Action Id object**

<table data-header-hidden><thead><tr><th width="232.66666666666663">Field Name</th><th width="141">Type</th><th>Description</th></tr></thead><tbody><tr><td>actionId</td><td>alpha numeric</td><td>actionId is a composite key of matchId , eventId and actionType</td></tr><tr><td>actionTypeId</td><td>int</td><td>The ID of the actionType (Pass, Shot..)</td></tr><tr><td>actionTypeMetadata</td><td>string</td><td>Type of metadata contained in packet (pass, shot, goalkeeperSave..)</td></tr><tr><td>clockTime</td><td>dateTime</td><td>The clock time within the match fixture ("01:41") means 1 minute 41 seconds into the match</td></tr><tr><td>period</td><td>string</td><td>Determined at start of a period of play ("FirstHalf", "FirstHalfExtraTime", "SecondHalf", "SecondHalfExtraTime", "Penalties")</td></tr><tr><td>fixtureId</td><td>alpha numeric</td><td>The match Fixture ID</td></tr><tr><td>__time</td><td>UTC dateTime</td><td><p>The timestamp of the event which differs from clockTime, for example:</p><p>(2024-02-22T01:10:28.953Z)</p></td></tr><tr><td>warnings</td><td>string</td><td>Any unusual game action/event warning message</td></tr><tr><td>messageId</td><td>alpha numeric uuid</td><td>messageId is a unique ID for each produced packet</td></tr><tr><td>team {}</td><td>object</td><td>Team object containing a team ID and team name details</td></tr><tr><td>clockTimeTicks</td><td>int</td><td>The game clock time in seconds</td></tr><tr><td>parentActionId</td><td>alpha numeric uuid</td><td>parentActionId is a composite key of the preceding connected action to the current one, i.e. the previous action's 'actionId</td></tr><tr><td>teamPossessionPhaseId</td><td>int</td><td>A number that increments per team every time they loose and gain possession</td></tr><tr><td>userId</td><td>alpha numeric</td><td>Administrative procedure to record the Data Collector/Scorer ID who sent the action, for match scoring performance and Quality Assurance</td></tr><tr><td>createdAt</td><td>UTC dateTime</td><td>The timestamp the event was first created</td></tr><tr><td>isRemoved</td><td>boolean</td><td>An indication that this packet should be 'deleted' or removed from records as the data within it has changed, this could be for example a goal packet that has now been ruled out for 'offside/VAR' etc</td></tr><tr><td>isSuccessful</td><td>boolean</td><td>Setting isSuccessful conditionally if the action resulted in a successful completion (successful pass, successful shot on goal)</td></tr><tr><td>metadata object { }</td><td>object array</td><td>This is an array consisting of detailed contextual meta data explaining the action, player and position of the event, wtih details such as type of event (pass, shot), distance of (pass, shot)</td></tr><tr><td>player</td><td>Player Object Array</td><td>Player details including player full name, player ID and player shirt number</td></tr></tbody></table>

<br>

## Actions List (Listed in 'actionTypeMetadata' object and described in detail in the 'Metadata' object)

All Event Action types that are returned from the endpoint (actionTypeMetadata)

```
  addedTime 

  aerial 

  badTouch 

  ballRecovery 

  ballTouch 

  bigChance 

  block 

  card 

  clearance 

  clock 

  cornerAwarded 

  cross 

  dispossessed 

  dribble 

  endFixture 

  endPeriod 


  freeKickAwarded  :{  isPenalty  :boolean true/false}

  position  :{  x  :1.67,  y  :11.04}

  reason  :  e.g. Foul  


  goal 

  goalkeeperCatch 

  goalkeeperCollection 

  goalkeeperDrop 

  goalkeeperPenaltyFaced 

  goalkeeperPunch 

  goalkeeperSave 

  goalkeeperThrow 

  goalKickAwarded 

  interception 

  launch 

  lineup 

  offside 

  offsideFor 

  ownGoal 

  pass   
  
  penaltyAwarded 

  penaltyTaken 

  playerOff 

  playerOn 

  playResumed 

  playStopped 

  postMatchChecks 

  shot 

  startFixture 

  startPeriod 

  substitution 

  tackle 

  throwInAwarded 

  throwInTaken 

  varDecision 

  varPending 
```

##

## Sample Response Extracts

```
{
  "__time": "2024-04-17T12:51:49.302Z",
  "metadata": "{\"addedTime\":null,\"aerial\":null,\"badTouch\":null,\"ballRecovery\":null,\"ballTouch\":null,\"bigChance\":null,\"block\":null,\"card\":null,\"clearance\":null,\"clock\":null,\"cornerAwarded\":null,\"cross\":null,\"dispossessed\":null,\"dribble\":null,\"endFixture\":null,\"endPeriod\":null,\"freeKickAwarded\":null,\"goal\":null,\"goalkeeperCatch\":null,\"goalkeeperCollection\":null,\"goalkeeperDrop\":null,\"goalkeeperPenaltyFaced\":null,\"goalkeeperPunch\":null,\"goalkeeperSave\":null,\"goalkeeperThrow\":null,\"goalKickAwarded\":null,\"interception\":null,\"launch\":null,\"lineup\":null,\"offside\":null,\"offsideFor\":null,\"ownGoal\":null,\"pass\":{\"actionContext\":null,\"bodyPart\":null,\"direction\":160.0,\"distance\":16.12,\"isAssist\":false,\"period\":{\"endTime\":\"2024-04-17T12:51:48.3230000Z\",\"startTime\":\"2024-04-17T12:51:48.3230000Z\"},\"position\":{\"x\":50.09,\"y\":50.03},\"targetPlayer\":null,\"targetPosition\":{\"x\":34.95,\"y\":55.57}},\"penaltyAwarded\":null,\"penaltyTaken\":null,\"playerOff\":null,\"playerOn\":null,\"playResumed\":null,\"playStopped\":null,\"postMatchChecks\":null,\"shot\":null,\"startFixture\":null,\"startPeriod\":null,\"substitution\":null,\"tackle\":null,\"throwInAwarded\":null,\"throwInTaken\":null,\"varDecision\":null,\"varPending\":null}",
  "period": "FirstHalf",
  "fixtureId": "2fb85f18-5639-4562-b3fc-2c968f76afa1",
  "warnings": null,
  "messageId": "08c146ce-4bf9-4d41-81f3-9e13da903887",
  "team": "{\"id\":\"98cfb91e-ccf0-4676-9a96-751c8419f63e\",\"name\":\"\"}",
  "clockTimeTicks": 2,
  "parentActionId": rfg301e0-eghj-11ee-ad7b-6ba5773f198a,
  "teamPossessionPhaseId": "0",
  "userId": "00u6r3bae4s60QktM5d7",
  "actionTypeMetadata": "pass",
  "createdAt": 1713358308323,
  "isRemoved": "false",
  "isSuccessful": "true",
  "actionTypeId": 150,
  "actionId": "40e91330-fcb9-11ee-ad7b-6ba5773f198a",
  "clockTime": "00:02",
  "player": "{\"firstName\":\"Jeremy\",\"fullName\":\"Jeremy Ebobisse\",\"id\":\"2a865e6c-beb0-45ae-98c1-ac8356336f17\",\"lastName\":\"Ebobisse\",\"shirtNumber\":\"11\"}"
},
{
  "__time": "2024-04-17T12:51:52.374Z",
  "metadata": "{\"addedTime\":null,\"aerial\":null,\"badTouch\":null,\"ballRecovery\":null,\"ballTouch\":null,\"bigChance\":null,\"block\":null,\"card\":null,\"clearance\":null,\"clock\":null,\"cornerAwarded\":null,\"cross\":null,\"dispossessed\":null,\"dribble\":null,\"endFixture\":null,\"endPeriod\":null,\"freeKickAwarded\":null,\"goal\":null,\"goalkeeperCatch\":null,\"goalkeeperCollection\":null,\"goalkeeperDrop\":null,\"goalkeeperPenaltyFaced\":null,\"goalkeeperPunch\":null,\"goalkeeperSave\":null,\"goalkeeperThrow\":null,\"goalKickAwarded\":null,\"interception\":null,\"launch\":null,\"lineup\":null,\"offside\":null,\"offsideFor\":null,\"ownGoal\":null,\"pass\":{\"actionContext\":null,\"bodyPart\":null,\"direction\":-85.0,\"distance\":29.61,\"isAssist\":false,\"period\":{\"endTime\":\"2024-04-17T12:51:50.9420000Z\",\"startTime\":\"2024-04-17T12:51:50.9420000Z\"},\"position\":{\"x\":36.07,\"y\":54.84},\"targetPlayer\":null,\"targetPosition\":{\"x\":38.78,\"y\":25.35}},\"penaltyAwarded\":null,\"penaltyTaken\":null,\"playerOff\":null,\"playerOn\":null,\"playResumed\":null,\"playStopped\":null,\"postMatchChecks\":null,\"shot\":null,\"startFixture\":null,\"startPeriod\":null,\"substitution\":null,\"tackle\":null,\"throwInAwarded\":null,\"throwInTaken\":null,\"varDecision\":null,\"varPending\":null}",
  "period": "FirstHalf",
  "fixtureId": "2fb85f18-5639-4562-b3fc-2c968f76afa1",
  "warnings": null,
  "messageId": "94069cfb-22ce-4657-836e-d23bb032e078",
  "team": "{\"id\":\"98cfb91e-ccf0-4676-9a96-751c8419f63e\",\"name\":\"\"}",
  "clockTimeTicks": 2,
  "parentActionId": abc301e0-efgh-11ee-lm7n-6ba5773f198a,
  "teamPossessionPhaseId": "0",
  "userId": "00u6r3bae4s60QktM5d7",
  "actionTypeMetadata": "pass",
  "createdAt": 1713358310942,
  "isRemoved": "false",
  "isSuccessful": "true",
  "actionTypeId": 150,
  "actionId": "4278b3e0-fcb9-11ee-ad7b-6ba5773f198a",
  "clockTime": "00:02",
  "player": "{\"firstName\":\"Alfredo\",\"fullName\":\"Alfredo Morales\",\"id\":\"67cdc7b5-ab47-44dc-848e-563212e392f9\",\"lastName\":\"Morales\",\"shirtNumber\":\"6\"}"
},
{
  "__time": "2024-04-17T13:23:51.635Z",
  "metadata": "{\"addedTime\":null,\"aerial\":null,\"badTouch\":null,\"ballRecovery\":null,\"ballTouch\":null,\"bigChance\":null,\"block\":null,\"card\":null,\"clearance\":null,\"clock\":null,\"cornerAwarded\":null,\"cross\":null,\"dispossessed\":null,\"dribble\":null,\"endFixture\":null,\"endPeriod\":null,\"freeKickAwarded\":null,\"goal\":null,\"goalkeeperCatch\":null,\"goalkeeperCollection\":null,\"goalkeeperDrop\":null,\"goalkeeperPenaltyFaced\":null,\"goalkeeperPunch\":null,\"goalkeeperSave\":null,\"goalkeeperThrow\":null,\"goalKickAwarded\":null,\"interception\":null,\"launch\":null,\"lineup\":null,\"offside\":null,\"offsideFor\":null,\"ownGoal\":null,\"pass\":{\"actionContext\":null,\"bodyPart\":\"Head\",\"direction\":62.0,\"distance\":13.01,\"isAssist\":false,\"period\":{\"endTime\":\"2024-04-17T13:02:22.4620000Z\",\"startTime\":\"2024-04-17T13:02:22.4620000Z\"},\"position\":{\"x\":64.76,\"y\":15.32},\"targetPlayer\":null,\"targetPosition\":{\"x\":70.79,\"y\":26.85}},\"penaltyAwarded\":null,\"penaltyTaken\":null,\"playerOff\":null,\"playerOn\":null,\"playResumed\":null,\"playStopped\":null,\"postMatchChecks\":null,\"shot\":null,\"startFixture\":null,\"startPeriod\":null,\"substitution\":null,\"tackle\":null,\"throwInAwarded\":null,\"throwInTaken\":null,\"varDecision\":null,\"varPending\":null}",
  "period": "FirstHalf",
  "fixtureId": "2fb85f18-5639-4562-b3fc-2c968f76afa1",
  "warnings": null,
  "messageId": "68542496-42c4-40a5-82d4-fd583d3ded0f",
  "team": "{\"id\":\"98cfb91e-ccf0-4676-9a96-751c8419f63e\",\"name\":\"\"}",
  "clockTimeTicks": 574,
  "parentActionId": null,
  "teamPossessionPhaseId": "34",
  "userId": "00u6r3bae4s60QktM5d7",
  "actionTypeMetadata": "pass",
  "createdAt": 1713358942462,
  "isRemoved": "false",
  "isSuccessful": "true",
  "actionTypeId": 150,
  "actionId": "bae301e0-fcba-11ee-ad7b-6ba5773f198a",
  "clockTime": "09:34",
  "player": "{\"firstName\":\"Jeremy\",\"fullName\":\"Jeremy Ebobisse\",\"id\":\"2a865e6c-beb0-45ae-98c1-ac8356336f17\",\"lastName\":\"Ebobisse\",\"shirtNumber\":\"11\"}"
}
```
