How to Use the Cricket Live Scores API

What is the Cricket Live Scores API?

The Cricket Live Scores API provides information on various amounts of cricket data including matches, partnerships, players, scorecards, series, teams, commentary and much more.

The API gathers information from the following match’s scores: ODI, T20, Test, BBL, IPL, and World Cup.

Ready to start building awesome apps? Get Started at RapidAPI’s API Marketplace!

Cricket Live Scores is a Freemium API, and the Basic plan allows for 2500 free requests a day. More pricing information can be found here.

How Can I Use the Cricket Live Scores API to Get Cricket Data?

There are a few quick steps to get you up and running using the Cricket Live Scores API:

  1. Sign up for a RapidAPI user account (it’s free!) to get a free API Key. Free API Key with RapidAPI
  2. Navigate to the API pricing page and subscribe to a pricing plan. To start, subscribe to the free tier that allows up to 2500 requests per day. If you need more than 2500 requests, you can upgrade to the Pro, Ultra, or Mega Plan to avoid overage charges. Cricket Live Scores API Pricing
  3. Return to the Cricket Live Scores API documentation and endpoints page.Cricket Live Scores API
  4. Pick one of the Cricket Live Scores API endpoints and select your preferred programming language from the dropdown. The current options are NodeJS, PHP, Python, Ruby, Objective-C, Java, C# (.NET), cURL, RapidQL. RapidAPI SDKs
  5. Fill out all required parameters (and any optional parameters you need for your project). Cricket API parameters
  6. Click “Test Endpoint” to test the API right in your browser, or copy the “Request Snippet” and integrate right into your website or application. Test the Cricket API and Grab the code snippet

This API will require users to start by calling the Matches/Series lists to obtain all of the possible Match and Series IDs. In order to find specific details on matches/series results, users will find specific scores for matches, series, or players.

Connect to API

What Kind of Information Can I Get From This API?

This example response from the Matches endpoint shows 10 upcoming, completed, or ongoing matches. These IDs can be found on the first line. Below, we can see that 43650 is the match ID for Match 7 of the Men’s OCI World Cup 2019 between Afghanistan and Sri Lanka.

Calling the Series endpoint allows for specific information about when the next set of series matches will be played.

An example response from the Series endpoint shows 26 ongoing matches. These IDs can be found on the first line, for example, we can see below that “2181” corresponds to the Men’s ODI World Cup 2019.

Using the Series ID (2181 in this example), we can call the Series Team endpoint to see what teams are in the Men’s ODL World Cup 2019.

API Architecture

Here is a graphical representation of this API’s endpoints.

Connect to API

FAQ: Frequently Asked Questions about the Cricket Live Scores API

Will buying different pricing tiered plans have different features?

  • The difference between Pro and Ultra plans is the number of requests you are allowed to make. You will have access to all of the API’s features from the Basic plan.

Can we use the cricket live scores API to get images of players?

  • Yes, you can get the image URL of all players in the Players endpoint.

Does this API offer Cricket Odds or betting tips of the matches?

  • Unfortunately, the API doesn’t provide the odds of the Cricket matches.

How often is the match list updated?

  • Matches will have the upcoming list of games from over 2 weeks in advance.

Does this API offer live scores or offer Inning/Over summaries?

Does this API offer detailed scorecard information of matches such as player of the match?

  • Yes, scorecards with details of scores as well as player of the match can be viewed in this endpoint.

Connect to API

How to use the Cricket Live Scores API by Programming Language

RapidAPI has many SDKs available to help you access the many APIs on the RapidAPI marketplace. For the Cricket Live Scores API, we have the following available programming languages:

How to use Cricket Live Scores API in Node.js

  1. Install unirest npm module.
    $ npm install unirest
  2. Pick any Cricket Live Scores API endpoint & select “NodeJS” under “Request Snippet.”
    RapidAPI Request Snippet Programming Languages SDKs
  3. Copy snippet & make the request.
    var unirest = require('unirest');
    
    unirest.post(API_URL)
      .header("X-RapidAPI-Key", API_KEY)
      .end(function (result) {
        console.log(result.status, result.headers, result.body);
      });

Read more about the node.js unirest SDK here.

Connect to API

How to use Cricket Live Scores API in PHP

Requirements:

  • cURL
  • PHP 5.4+
  1. Install unirest-php with Composer or from source.
    • With Composer:
      {
          "require-dev": {
              "mashape/unirest-php": "3.*"
          }
      }
    • Install from Source:
      require_once '/path/to/unirest-php/src/Unirest.php';
  2. Choose any API endpoint and select “PHP” from the drop-down to get the request snippet.
  3. Create a request with the selected API endpoint snippet:
    $headers = array('Accept' => 'application/json');
    
    $response = UnirestRequest::post("API_URL",
      array(
        "X-RapidAPI-Key" => "API_KEY"
      )
    );

Connect to API

How to use Cricket Live Scores API in Python

  1. Install Unirest for Python using pip:
    $ pip install unirest
  2. Select any Cricket Live Scores API endpoint & select “Python” from the drop-down to copy the request snippet.
  3. Make the request by importing unirest:
    import unirest
    
    response = unirest.post(API_URL,
      headers={
        "X-RapidAPI-Key": API_KEY,
        "Content-Type": "application/x-www-form-urlencoded"
      },
      params={
        "parameter": "value"
      }
    )
    
    response.code # The HTTP status code
    response.headers # The HTTP headers
    response.body # The parsed response
    response.raw_body # The unparsed response

Connect to API

How to use Cricket Live Scores API in Ruby

Requirements: Ruby >= 2.0

  1. Install the unirest gem:
    gem install unirest
  2. From the Cricket Live Scores API endpoints page, select “Ruby” from the drop-down to get the request snippet.
  3. Make a request by requiring unirest:
    require 'unirest'
    
    response = Unirest.post API_URL,
      headers:{
        "X-RapidAPI-Key" => API_KEY,
        "Content-Type" => "application/x-www-form-urlencoded"
      },
      parameters:{
        "parameter" => "value"
      }
    
    response.code # Status code
    response.headers # Response headers
    response.body # Parsed body
    response.raw_body # Unparsed body

Learn more here.

How to use Cricket Live Scores API in Java

  1. Include the unirest library with or without Maven.
  2. Select any API endpoint and choose “Java” from the request snippet drop down to get the request snippet.
  3. Make a request:
    HttpResponse response = Unirest.post(API_URL)
    .header("X-RapidAPI-Key", API_KEY)
    .queryString("parameter", "value")
    .field("parameter", "value")
    .asJson();

Connect to API

How to use Cricket Live Scores API in Objective-C

Requirements: The Unirest-Obj-C client library requires ARC (Automatic Reference Counting) to be enabled in your Xcode project.

  1. Download the Objective-C Unirest Library.
  2. Get the Objective-C request snippet from any API endpoint.
  3. Make the request:
    #import <UNIRest.h>
    
    NSDictionary *headers = @{@"Authorization": @"", @"X-RapidAPI-Key": @API_KEY, @"Content-Type": @"application/x-www-form-urlencoded"};
    UNIUrlConnection *asyncConnection = [[UNIRest post:^(UNISimpleRequest *request) {
      [request setUrl:@API_URL];
      [request setHeaders:headers];
    }] asJsonAsync:^(UNIHTTPJsonResponse *response, NSError *error) {
      NSInteger code = response.code;
      NSDictionary *responseHeaders = response.headers;
      UNIJsonNode *body = response.body;
      NSData *rawBody = response.rawBody;
    }];

Connect to API

Have an API you want to add to our API Marketplace?

#DIV_1 {
bottom: 0px;
box-sizing: border-box;
color: rgb(10, 10, 10);
cursor: pointer;
float: left;
height: 95px;
left: 0px;
position: relative;
right: 0px;
text-decoration: none solid rgb(10, 10, 10);
text-size-adjust: 100%;
top: 0px;
width: 270px;
column-rule-color: rgb(10, 10, 10);
perspective-origin: 135px 47.5px;
transform-origin: 135px 47.5px;
caret-color: rgb(10, 10, 10);
background: rgb(0, 140, 220) none repeat scroll 0% 0% / auto padding-box border-box;
border: 1px solid rgb(227, 224, 224);
border-radius: 0 0 4px 4px;
font: normal normal 400 normal 16px / 24px Lato, sans-serif;
margin: 0px 0px 15px;
outline: rgb(10, 10, 10) none 0px;
}/*#DIV_1*/

#A_2 {
box-sizing: border-box;
text-size-adjust: 100%;
perspective-origin: 0px 0px;
transform-origin: 0px 0px;
font: normal normal 400 normal 16px / 24px Lato, sans-serif;
}/*#A_2*/

#DIV_3 {
bottom: 0px;
box-sizing: border-box;
color: rgb(0, 0, 238);
cursor: pointer;
float: left;
height: 63px;
left: 0px;
position: relative;
right: 0px;
text-decoration: none solid rgb(0, 0, 238);
text-size-adjust: 100%;
top: 0px;
width: 70px;
column-rule-color: rgb(0, 0, 238);
perspective-origin: 35px 31.5px;
transform-origin: 35px 31.5px;
caret-color: rgb(0, 0, 238);
border: 0px none rgb(0, 0, 238);
border-radius: 5px 5px 5px 5px;
font: normal normal 400 normal 16px / 24px Lato, sans-serif;
margin: 15px 5px 15px 15px;
outline: rgb(0, 0, 238) none 0px;
}/*#DIV_3*/

#IMG_4 {
bottom: -35.0781px;
box-sizing: border-box;
color: rgb(0, 0, 238);
cursor: pointer;
display: block;
height: 66.5781px;
left: 35px;
max-width: 100%;
position: absolute;
right: -35px;
text-decoration: none solid rgb(0, 0, 238);
text-size-adjust: 100%;
top: 31.5px;
vertical-align: middle;
width: 70px;
column-rule-color: rgb(0, 0, 238);
perspective-origin: 35px 33.2813px;
transform: matrix(1, 0, 0, 1, -35, -33.5);
transform-origin: 35px 33.2813px;
caret-color: rgb(0, 0, 238);
border: 0px none rgb(0, 0, 238);
font: normal normal 400 normal 16px / 24px Lato, sans-serif;
outline: rgb(0, 0, 238) none 0px;
}/*#IMG_4*/

#DIV_5 {
box-sizing: border-box;
color: rgb(255, 255, 255);
cursor: pointer;
float: left;
height: 46px;
text-decoration: none solid rgb(255, 255, 255);
text-size-adjust: 100%;
width: 168px;
column-rule-color: rgb(255, 255, 255);
perspective-origin: 84px 23px;
transform-origin: 84px 23px;
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 400 normal 16px / 24px Lato, sans-serif;
margin: 22px 0px 0px 5px;
outline: rgb(255, 255, 255) none 0px;
}/*#DIV_5*/

#SPAN_6 {
box-sizing: border-box;
color: rgb(255, 255, 255);
cursor: pointer;
display: block;
float: left;
width: 150px;
height: 27px;
text-decoration: none solid rgb(255, 255, 255);
text-size-adjust: 100%;
width: 107.047px;
column-rule-color: rgb(255, 255, 255);
perspective-origin: 53.5156px 13.5px;
transform-origin: 53.5156px 13.5px;
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 700 normal 18px / 27px Lato, sans-serif;
outline: rgb(255, 255, 255) none 0px;
}/*#SPAN_6*/

#SPAN_7 {
box-sizing: border-box;
color: rgb(255, 255, 255);
cursor: pointer;
display: block;
float: left;
height: 19px;
text-decoration: none solid rgb(255, 255, 255);
text-size-adjust: 100%;
width: 110.188px;
column-rule-color: rgb(255, 255, 255);
perspective-origin: 55.0938px 9.5px;
transform-origin: 55.0938px 9.5px;
caret-color: rgb(255, 255, 255);
border: 0px none rgb(255, 255, 255);
font: normal normal 700 normal 13px / 19.5px Lato, sans-serif;
outline: rgb(255, 255, 255) none 0px;
}/*#SPAN_7*/

How to use Cricket Live Scores API in .NET

  1. Download the unirest-net library and reference it in your project:
  2. On any Cricket Live Scores API endpoint, select “.NET” from the drop down to get the request snippet.
  3. Make the request:
    Task<HttpResponse<MyClass>> response = Unirest.post(API_URL)
    .header("X-RapidAPI-Key", API_KEY)
    .header("Content-Type", "application/x-www-form-urlencoded")
    .asJson();

How to use Cricket Live Scores API in cURL

  1. From an endpoint, select “cURL” from the request snippet dropdown.
  2. Make the request:
    curl --get --include 'API_URL' 
      -H 'X-RapidAPI-Key'

Connect to API

The post How to Use the Cricket Live Scores API appeared first on Last Call – RapidAPI Blog.

Source: RapidAPI