How to keep your database in SYNC
This is one of the most vital how-to guides. We’ll discuss how you can keep your database in sync with ours.
Let’s imagine you want to know all the fixtures of one specific day. You want to show these matches to your application users and send updates to them. You can use our fixtures by date endpoint to accomplish this.
In this example, we’ll take the date of 2022-09-03.
Request
Response
https://api.sportmonks.com/v3/football/fixtures/date/2022-09-03?api_token=YOUR_TOKEN
{
"data": [
{
"id": 18528309,
"sport_id": 1,
"league_id": 743,
"season_id": 19684,
"stage_id": 77457688,
"group_id": null,
"aggregate_id": null,
"round_id": 273906,
"state_id": 5,
"venue_id": 2315,
"name": "Necaxa vs León",
"starting_at": "2022-09-03 00:00:00",
"result_info": "León won after full-time.",
"leg": "1/1",
"details": null,
"length": 90,
"placeholder": false,
"last_processed_at": "2023-03-02 17:48:14",
"has_odds": true,
"starting_at_timestamp": 1662163200
},
{
"id": 18573151,
"sport_id": 1,
"league_id": 2034,
"season_id": 19430,
"stage_id": 77456822,
"group_id": null,
"aggregate_id": null,
"round_id": 278917,
"state_id": 5,
"venue_id": null,
"name": "Mario Mendez vs Panamá Oeste",
"starting_at": "2022-09-03 00:00:00",
"result_info": "Game ended in draw.",
"leg": "1/1",
"details": null,
"length": 90,
"placeholder": false,
"last_processed_at": "2023-02-06 16:01:12",
"has_odds": true,
"starting_at_timestamp": 1662163200
},
//And more
Now, sometimes fixtures are deleted due to technical reasons. These fixtures will be removed from the API response.
If you only use the previous request and a fixture is removed, then it won't be in your response. This results in your database not being in sync with ours.
Luckily, we have a solution for this. If you add
&filters=deleted
to your request, you will get all the fixtures that are deleted from that specific date. Request
Response
https://api.sportmonks.com/v3/football/fixtures/date/2022-09-03?api_token=YOUR_TOKEN&filters=deleted&include=state
{
"data": [
{
"id": 18454901,
"sport_id": 1,
"league_id": 764,
"season_id": 19267,
"stage_id": 77456294,
"group_id": null,
"aggregate_id": null,
"round_id": 265310,
"state_id": 20,
"venue_id": null,
"name": "UTC Cajamarca vs Alianza Atlético",
"home_score": null,
"away_score": null,
"starting_at": "2022-09-03 22:00:00",
"result_info": null,
"leg": "1/1",
"details": null,
"length": 90,
"placeholder": false,
"last_processed_at": null,
"starting_at_timestamp": 1662242400,
"state": {
"id": 20,
"state": "DELETED",
"name": "Deleted",
"short_name": "DEL",
"developer_name": "DELETED",
"is_live": false,
"is_pending": false,
"is_period_end": false,
"is_final_state": false,
"is_cancelled": false,
"is_final_standing_state": false,
"is_completed": false,
"type_id": null,
"is_deleted": true,
"is_notstarted": false,
"sections_active": false
}
},
{
"id": 18454902,
"sport_id": 1,
"league_id": 764,
"season_id": 19267,
"stage_id": 77456294,
"group_id": null,
"aggregate_id": null,
"round_id": 265310,
"state_id": 20,
"venue_id": null,
"name": "Deportivo Municipal vs Real Garcilaso",
"home_score": null,
"away_score": null,
"starting_at": "2022-09-03 22:00:00",
"result_info": null,
"leg": "1/1",
"details": null,
"length": 90,
"placeholder": false,
"last_processed_at": null,
"starting_at_timestamp": 1662242400,
"state": {
"id": 20,
"state": "DELETED",
"name": "Deleted",
"short_name": "DEL",
"developer_name": "DELETED",
"is_live": false,
"is_pending": false,
"is_period_end": false,
"is_final_state": false,
"is_cancelled": false,
"is_final_standing_state": false,
"is_completed": false,
"type_id": null,
"is_deleted": true,
"is_notstarted": false,
"sections_active": false
}
},
// And More
Adding
&filters=deleted
allows you to keep your database in sync with ours.We've included the state to have a textual representation of the fixtures' state.
Last modified 6mo ago