Links

Pagination

In the previous tutorial, we discussed how you can set your desired time zone. Before we dive into the extra details of our API, we need to discuss one of the fundamentals of our API: pagination.
“How is it possible that I cannot find all the data I requested?”
Responses sometimes return more than 1.000 results. With that much data, requests can become slow and hard to work with. That’s why these endpoints use something called pagination. Instead of returning all 1.000+ results, you'll get 25 results per page.

Create your request

Let's request all the available fixtures in the free plan. We can do this by using the GET All Fixtures endpoint:​
https://api.sportmonks.com/v3/football/fixtures?api_token=YOUR_TOKEN
Response
],
"pagination": {
"count": 25,
"per_page": 25,
"current_page": 1,
"next_page": "https://api.sportmonks.com/v3/football/fixtures?page=2",
"has_more": true
},
If you navigate to the end of the response, you can see information about pagination. You can see that there are 25 results returned per page, the current page, the link to the next page and an indicator has_more that is true or false. You can paginate using the has_more parameter to determine if you can still propagate through the results.
"So, how do I get to the second page then?’" Excellent question. Going to the second page is easy! Simply add &page=2 to your request.
https://api.sportmonks.com/v3/football/fixtures?api_token=YOUR_TOKEN&page=2
The request also contains a next_page field with the same includes and parameters of your previous request. See the example below
1
"pagination": {
2
"count": 25,
3
"per_page": 25,
4
"current_page": 1,
5
"next_page": "https://api.sportmonks.com/v3/football/fixtures?leagues=2&page=2",
6
"has_more": true
7
},
Now that you know about pagination, we can explore our API’s endless possibilities in the next chapter: enriching your response.​
Note that every page called counts against the rate limiter. So a call to pages 1,2,3,4 and 5 counts as 5 calls in the rate limiter

Initial data load

It is now possible to add the filters=populate to your query parameter. This parameter allows for a higher pagination limit (max 1000), so you can populate your database in a more convenient way instead of using the default pagination limit of 50. To prevent our services from overloading, using includes is disabled when this filter is added to the request.