LogoLogo
Cricket APISportMonksContactFootball API
  • Welcome
  • Getting Started
    • Getting started
    • All endpoints
    • Enriching your response
  • Our API
    • Introduction to our API
    • Continents
      • GET All Continents
      • GET Continent by ID
    • Countries
      • GET All Countries
      • GET Country by ID
    • Leagues
      • GET All Leagues
      • GET League by ID
    • Seasons
      • GET All Seasons
      • GET Season by ID
    • Fixtures
      • GET All Fixtures
      • GET Fixture by ID
    • Livescores
      • GET All Livescores
    • Teams
      • GET All Teams
      • GET Team by ID
      • GET Squad by Team and Season ID
    • Players
      • GET All Players
      • GET Player by ID
    • Officials
      • GET All Officials
      • GET Official by ID
    • Venues
      • GET All Venues
      • GET Venue by ID
    • Positions
      • GET All Positions
      • GET Position by ID
    • Stages
      • GET All Stages
      • GET Stage by ID
    • Team Rankings
      • GET Global Team Rankings
    • Standings
      • GET Standings by Season ID
      • GET Standings by Stage ID
    • Scores
      • GET All Scores
      • GET Score by ID
  • Relationships
    • Scoreboards
    • Official/Umpries
    • Results
  • API References
  • API Reference Guide
  • API Rate limit
  • Statuses and definitions
  • Demo response files
  • Events
  • Statistics
  • General
  • SportMonks
  • Plans & Pricing
  • FAQ
  • Contact
  • Changelog
    • Changelog
Powered by GitBook
On this page
  • Adding team information
  • Adding Runs and Scoreboards

Was this helpful?

  1. Getting Started

Enriching your response

PreviousAll endpointsNextIntroduction to our API

Last updated 4 years ago

Was this helpful?

The flexibility of our API is in the part where you build your own responses by adding include parameters to your request. On t you can find information on what data can be included and how deep you can add includes. To best describe how to use includes and what the include limit means, we will give an explanation based on some example calls.

Adding team information

Useful information for every game is home and away team information. How else would you know between which two teams the game is being played? Here we start with the interesting part, including team information.

https://cricket.sportmonks.com/api/v1/livescores?api_token=__TOKEN__&include=localteam,visitorteam

Note that we have extended our request with &include=localteam,visitorteam. This results in information about the home and away team. You will retrieve a full team object related to the response which includes the name, logo url and much more information.

Adding Runs and Scoreboards

What is a game without the progression? Important information for your application to show could be bowling and batting information, lineup or runs. You can use these includes: localteam,visitorteam,lineup,runs,bowlings,battings

https://cricket.sportmonks.com/api/v1/livescores?api_token=__TOKEN__&include=localteam,visitorteam,lineup,runs,bowlings,battings

With the current URL we have no clue to which scoreboard the player relates to. It only shows the player_id, not the actual name.

Adding nested includes

Luckily the flexibility of the API goes a step further with nested includes. Nested includes are basically relations on relations for the base endpoint. We can enrich the runs, battings etc. with actual player information showing all details of the player who was responsible for the score.

https://cricket.sportmonks.com/api/v1/livescores/now?api_token=__TOKEN__&include=localteam,visitorteam,lineup.player,runs.team,bowlings.team,battings.team

Note we have added the .player to the lineup include? Or .teams to runs, battings and bowlings?

You can add as many nested includes as described in the of the endpoint it self.

every endpoin
documentation section