LogoLogo
Quick StartFootball APIContactAPI 3.0
  • Welcome
  • Changelog
  • Getting Started
    • Get Started
    • Documentation for the documentation
  • Endpoint overview
    • Continents
      • GET All Continents
      • GET Continent by ID
    • Countries
      • GET All Countries
      • GET Country by ID
    • Leagues
      • GET All Leagues
      • GET League by ID
      • GET Leagues by Country ID
      • Search Leagues by Name
    • Seasons
      • GET All Seasons
      • GET Season by ID
    • Fixtures
      • GET Fixture by ID
      • GET Last Updated Fixtures
      • GET Fixtures by Date
      • GET Fixtures by Date Range
      • GET Fixtures by Date Range for Team
      • GET Fixtures by Multiple ID's
      • GET Deleted Fixtures
    • Statistics
    • Livescores
      • GET All Livescores
      • GET All In play Livescores
    • News API
      • GET All News
      • GET News For Upcoming Fixtures
      • GET News by Season ID
    • Commentaries
      • Commentaries by Fixture ID
    • Video Highlights
      • Get Video Highlights by Fixture ID
    • Head 2 Head
      • GET Head 2 Head by Team IDs
    • Standings
      • GET Standings by Season ID
      • GET LIVE Standings
      • GET Standings by Season ID and Round ID
      • GET Standings by Season and Date(time)
      • GET Standings Corrections by Season ID
    • Teams
      • GET Team by ID
      • GET Teams by Country ID
      • GET Teams by Season ID
      • Search Team by Name
      • GET Current Leagues by Team ID
      • Get All Leagues by Team ID
    • Players
      • GET Player by ID
      • GET Players by Country ID
      • Search Player by Name
    • Topscorers
      • GET Topscorers by Season ID
      • GET Topscorers Aggregated by Season ID
    • Rivals
      • GET Rivals by Team ID
    • Venues
      • GET Venue by ID
      • GET Venues by Season ID
    • Rounds
      • GET Rounds by Season ID
      • GET Round by ID
    • Odds
      • GET Odds by Fixture ID and Bookmaker ID
      • GET Odds by Fixture ID and Market ID
      • GET Odds by Fixture ID
      • GET Inplay Odds by Fixture ID
    • Coaches
      • GET Coach by ID
    • Stages
      • GET Stage by ID
      • GET Stages by Season ID
    • Bookmakers
      • GET All Bookmakers by Fixture ID
      • GET All Bookmakers
      • GET Bookmaker by ID
    • Markets
      • GET All Fixtures by Market ID
      • GET All Markets
      • GET Market by ID
    • Team Squads
      • GET Team Squad by Team and Season ID
    • TV Stations
      • GET TV Station by Fixture ID
    • Prediction API
      • GET Leagues and Performances
      • GET Probabilities
      • GET Probabilities by Fixture ID
      • GET Value Bets
      • GET Value Bet by Fixture ID
  • Tutorials
    • Introduction to our API
      • Make your first request
      • Set your time zone
      • Pagination
    • Enriching your response
      • Includes
      • Nested includes
    • Filtering, limiting & sorting
      • Filtering
      • Limiting
      • Sorting
    • Schedule, fixtures & livescores
      • Season schedule
      • Fixtures
      • Livescores
    • Statistics
      • Match statistics
      • Team statistics
      • Player statistics
      • Season statistics
    • League & topscorers standings
      • League standings
      • Topscorers standings
    • Odds & predictions
      • Odds
        • Odds by fixture, bookmaker and market id
        • FlatOdds
        • InplayOdds
      • Predictions
  • MySportmonks
    • How-to build a custom plan
    • ID Finder
  • How-to Guides
    • Get Started with our how-to guides
      • How-to build your API requests
    • Livescores & fixtures
      • How-to build a livescore website
      • How-to build a schedule page
    • Match & team pages
      • How-to build a match page with events and statistics
      • How-to build a match page with line-ups/formations
      • How-to build a team page with season stats and squads
    • How-to build standings and topscorer standings
      • League standings
      • Topscorer standings
    • Odds & predictions
      • How-to build a match page with odds
      • How-to build a betting odds portal
      • How-to use the predictions API
    • How-to build a fantasy game
    • Developer tools
      • How-to use Sportmonks' APIs in Postman
    • How-to keep your database in sync
    • World Cup 2022
    • EURO 2024
    • Football widgets
      • How-to set up football widgets in your web application
      • Configurations
      • Widgets overview
        • Livescore widget
        • International Cup widgets
  • API References
    • API reference guide
    • Data features
    • ID Finder
    • Code libraries
    • Demo response files
    • Statuses and definitions
    • API Rate limiting
    • Response codes
    • Meta description
  • General
  • Sportmonks
  • Plans & pricing
  • FAQ
  • Contact
Powered by GitBook
On this page
  • What is limiting?
  • Create the request
  • Evaluate the response
  • Limit the response

Was this helpful?

Export as PDF
  1. Tutorials
  2. Filtering, limiting & sorting

Limiting

Sometimes you just want to limit your response a little bit!

PreviousFilteringNextSorting

Last updated 3 years ago

Was this helpful?

In the previous tutorial, we have explained the fundamentals of filtering API responses, which allows you to request the exact data you need. However, sometimes the response can be rather large. In such cases, you can use our limiting feature. In this part of our tutorial, you will be able to limit your API responses.

What is limiting?

Limiting, as its name suggests, will limit the response you get from our API to a specific amount. Limiting your API responses can come in handy when you want to avoid big API responses. In this tutorial, we'll show you how limiting is used and why it may be handy for you. Let's go!

Create the request

In this tutorial, we will request all the fixtures from the 20/21 season from the Scottish Premiership (season id: 17141). As for the endpoint, we’ll go with . Furthermore, as discussed in our tutorial, we’ll enrich the response with an include. In this case, we’ll use the include called fixtures

The below request will give you all the fixtures of the 20/21 season of the Scottish Premiership (season id: 17141).

The response is enormous. Therefore, we've copied a small snippet instead of the full response.

https://soccer.sportmonks.com/api/v2.0/seasons/17141?api_token={API_TOKEN}&include=fixtures
{
    "data": {
        "id": 17141,
        "name": "2020/2021",
        "league_id": 501,
        "is_current_season": true,
        "current_round_id": 194976,
        "current_stage_id": 77447501,
        "fixtures": {
            "data": [
                {
                    "id": 16475283,
                    "league_id": 501,
                    "season_id": 17141,
                    "stage_id": 77447501,
                    "round_id": 194968,
                    "group_id": null,
                    "aggregate_id": null,
                    "venue_id": 281425,
                    "referee_id": 15818,
                    "localteam_id": 496,
                    "visitorteam_id": 258,
                    "winner_team_id": 496,
                    "weather_report": {
                        "code": "clouds",
                        "type": "broken clouds",
                        "icon": "https://cdn.sportmonks.com/images/weather/04d.png",
                        "temperature": {
                            "temp": 60.62,
                            "unit": "fahrenheit"
                        },
                        "temperature_celcius": {
                            "temp": 15.9,
                            "unit": "celcius"
                        },
                        "clouds": "75%",
                        "humidity": "72%",
                        "pressure": 1013,
                        "wind": {
                            "speed": "5.82 m/s",
                            "degree": 300
                        },
                        "coordinates": {
                            "lat": 55.83,
                            "lon": -4.43
                        },
                        "updated_at": "2020-08-01T15:45:06.417645Z"
                    },
                    "commentaries": false,
                    "attendance": null,
                    "pitch": null,
                    "details": null,
                    "neutral_venue": false,
                    "winning_odds_calculated": true,
                    "formations": {
                        "localteam_formation": "4-2-3-1",
                        "visitorteam_formation": "3-4-2-1"
                    },
                    "scores": {
                        "localteam_score": 1,
                        "visitorteam_score": 0,
                        "localteam_pen_score": null,
                        "visitorteam_pen_score": null,
                        "ht_score": "1-0",
                        "ft_score": "1-0",
                        "et_score": null,
                        "ps_score": null
                    },
                    "time": {
                        "status": "FT",
                        "starting_at": {
                            "date_time": "2020-08-01 14:00:00",
                            "date": "2020-08-01",
                            "time": "14:00:00",
                            "timestamp": 1596290400,
                            "timezone": "UTC"
                        },
                        "minute": 90,
                        "second": null,
                        "added_time": null,
                        "extra_minute": null,
                        "injury_time": null
                    },
                    "coaches": {
                        "localteam_coach_id": 1621,
                        "visitorteam_coach_id": 22145896
                    },
                    "standings": {
                        "localteam_position": 3,
                        "visitorteam_position": 12
                    },
                    "assistants": {
                        "first_assistant_id": 12770,
                        "second_assistant_id": 36793,
                        "fourth_official_id": 19329
                    },
                    "leg": "1/1",
                    "colors": {
                        "localteam": {
                            "color": "#F0F0F0",
                            "kit_colors": "#F0F0F0,#F0F0F0,#0A0A0A,#0A0A0A,#0A0A0A,#FFDF1B,#F0F0F0"
                        },
                        "visitorteam": {
                            "color": "#FDBD0F",
                            "kit_colors": "#FDBD0F,#FDBD0F,#FAE403,#FAE403,#5C8FAE,#FFDF1B,#FDBD0F"
                        }
                    },
                    "deleted": false
                },
                

Season Field Description

Field

Description

data

Opens an array of data you've requested

id

The unique season id

name

The name of the season

league_id

The unique league id the season belongs to

is_current_season

Indicates if the season is the current one. Possible values are "true" or "false"

current_round_id

The unique id of the current round

current_stage_id

The unique id of the current stage

Fixtures Field Description

Field

Description

data

Opens an array of data you've requested

id

A unique fixture id

league_id

The unique id of the league the fixture belongs to

season_id

The unique id of the season the fixture belongs to

stage_id

The unique id of the stage the fixture belongs to

round_id

The unique id of the round the fixture belongs to

group_id

The unique id of the group the fixture belongs to

aggregate_id

Indicates if the fixture has an aggregated score

venue_id

The unique id of the venue the fixture is played at

referee_id

The unique id of the referee that is in charge of the fixture

localteam_id

The unique id of the local team

visitorteam_id

The unique id of the visitor team

winnerteam_id

Contains the id of the team that won the fixture

weather_report

commentaries

Indicates if this fixture has commentaries available

attendance

Give information about the visitor attendance of the fixture

pitch

details

Optional additional information.

neutral_venue

Indicates if the fixture was played at a neutral fixture. This often happens in cup finals

formations

scores

Opens an array containing the scores of the fixture

localteam_score

The amount of goals the local team has scored in this fixture

visitorteam_score

The amount of goals the visitor team has scored in this fixture

localteam_pen_score

The amount of penalty goals the local team has scored in this fixture (only available when the fixture goes into penalty shootout)

visitorteam_pen_score

The amount of penalty goals the visitor team has scored in this fixture (only available when the fixture goes into penalty shootout)

ht_score

The score at half time

ft_score

The score at full time (90 minutes)

et_score

The score in extra time (only available when the fixture goes into extra time)

ps_score

The score of the penalty shootout (only available when the fixture goes into penalty shootout)

time

Opens an array containing the time details of the fixture

status

starting_at

Opens an array containing the time details of the fixture

date_time

Gives the date and time the fixture starts

date

Gives the date on which the fixture is played

time

Gives the starting time of the fixture

timestamp

The timestamp notation of the match

timezone

Indicates in which timezone you've requested the data

minute

Indicates in which minute the fixture is in

second

Indicates in which second the fixture is in

added_time

Indicates how many added time is added

extra_minute

Extra minute is when a fixture goes to extra time. Extra_minute will count from 0 to 15 and from 15 to 30.

injury_time

In case of added time it will end up in injury_minute

coaches

Opens an array containing the unique id's of the coaches

localteam_coach_id

The unique id of the coach from the local team

visitorteam_coach_id

The unique id of the coach from the visitor team

standings

Opens an array containing the standings of the local- and visitorteam

localteam_position

Indicates in which positions the local team is before the fixture

visitorteam_position

Indicates in which positions the visitor team is before the fixture

assistants

Opens an array containing the unique id's of the assistant referees

first_assistant_id

The unique id of the first assistant

second_assistant_id

The unique id of the second assistant

fourth_official_id

The unique id of the fourth official

leg

Indicates in how many legs this fixture is played

colors

Opens an array containing information about the team colors

localteam

Opens an array containing information about the local team colors

color

The main color code of the local team

kit_colors

The kit color codes of the local team

visitorteam

Opens an array containing information about the visitor team colors

color

The main color code of the visitor team

kit_colors

The kit color codes of the local team

deleted

is_placeholder

This property indicates if the resource is used to display dummy data. The false of this property will always be a boolean value.

Evaluate the response

Your first thought is probably: ‘Wow that’s an enormous response’. This is because football seasons tend to have a large number of matches. In order, to make the response more legible we can introduce a limit.

Limit the response

By limiting the response, we mean that you can limit the number of results per page. Let’s say we want to limit the response to only five results per page. You still need to use the fixtures include, but now you can add :limit(X|X).

The first attribute (X) is the number of records per page, while the second (X) is the page currently browsed.

For example, if you want 5 fixtures per page and you want to browse the first page: &include=fixtures:limit(5|1)

https://soccer.sportmonks.com/api/v2.0/seasons/17141?api_token={API_TOKEN}&include=fixtures:limit(5|1)

Now there are only five results per page! Moreover, you can simply replace the ‘1’ in (5|1) for a ‘2’, if you want to go to the second page. And just like that, you have successfully limited an API response!

Note that paginating through includes count towards your request limit

You’ve learnt how to filter and limit your response. Next up you will learn how to sort the API response.

Opens an array of weather details. Possible values of the data in this array can be found in our

Gives information about the pitch. Possible values can be found in our

Opens an array containing the lineup formations of the teams. Possible values can be found in our

Indicates in which phase the fixture is in. Possible values can be found in our

Indicates if the team was deleted. More information:

season by id
includes
statuses and definitions
statuses and definitions
statuses and definitions
statuses and definitions
Keep in Sync