How-to keep your database in sync

This is the last and one of the most vital how-to guides. We’re going to 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.

For example the fixtures of 2020-08-02:

Request
Meta description
Request
https://soccer.sportmonks.com/api/v2.0/fixtures/date/2020-08-02?api_token={API_TOKEN}
Meta description
"pagination": {
"total": 562,
"count": 100,
"per_page": 100,
"current_page": 1,
"total_pages": 6,
"links": {
"next": "https://soccer.sportmonks.com/api/v2.0/fixtures/date/2020-08-02?page=2"
}
}
}
}

In the meta description, you can see that the response gives you a total number of 562 results.

The total number of results depends on the plan you're subscribed to.

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 &deleted=1 to your request, you will get all the fixtures that were in the original response. Including the deleted fixtures. In the meta description, you can see that the response gives you a total of 697 results.

Request
Part of fixture response
Meta description
Request
https://soccer.sportmonks.com/api/v2.0/fixtures/date/2020-08-02?api_token={API_TOKEN}&deleted=1
Part of fixture response
"time": {
"status": "Deleted",
"starting_at": {
"date_time": "2020-08-02 00:00:00",
"date": "2020-08-02",
"time": "00:00:00",
"timestamp": 1596326400,
"timezone": "UTC"
},
Meta description
"pagination": {
"total": 697,
"count": 100,
"per_page": 100,
"current_page": 1,
"total_pages": 7,
"links": {
"next": "https://soccer.sportmonks.com/api/v2.0/fixtures/date/2020-08-02?page=2"
}
}
}
}

Adding &deleted=1 allows you to keep your database in sync with ours.

You can see that a fixture is deleted in thestatus field of the fixtures.