Introduction

Entity Sports application programming interfaces (API) give you access to our sports data. You can use our Entity Sports API to build web and mobile sports application. Either it's fantasy sports or live score our data full fills requirements for all type of applications.

Entity Sports API deliver season, competition, teams, matches, player, statistical data for Cricket and Soccer. Since the API is true to RESTful principles, it’s easy to interact with using any tool capable of performing https requests, such as Postman or cURL.

To allow you to interact securely with our API from a client-side web application (though you should remember that you should never expose your API keys in any public website's client-side code). JSON will be returned in all responses from the API, including errors.

Base URL

                  https://doc.entitysport.com/

                
Client libraries
$url = "https://rest.entitysport.com/v2/?token=[ACCESS_TOKEN]";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

$resp = curl_exec($curl);
curl_close($curl);

var_dump($resp);
import requests
url = "https://rest.entitysport.com/v2/?token=[ACCESS_TOKEN]"
resp = requests.get(url)
print(resp.status_code)
URL url = new URL("https://rest.entitysport.com/v2/?token=[ACCESS_TOKEN]");
HttpURLConnection http = (HttpURLConnection)url.openConnection();
System.out.println(http.getResponseCode() + " " + http.getResponseMessage());
http.disconnect();
var request = require('request');
var options = {
    url: "https://rest.entitysport.com/v2/?token=[ACCESS_TOKEN]"
};
function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}
request(options, callback);
curl -X GET "https://rest.entitysport.com/v2/?token=[ACCESS_TOKEN]

Getting Started

Getting Your Keys

You will need an active access key and secret key with a valid subsciption to start using our API. Please visit entitysport.com to request your keys and subscription.

Obtaining Token

To access any API, you need a token. A token can be generated using your keys. Token is a piece of information that would allow you to access our API data for a short period of time (expire time). Auth API provides you the token, by validating your keys. Request to our Auth API whenever the access token is expired or unavailable.

  Request

  • Path: /v2/auth/
  • Method: Post
  • POST Parameters
    • access_key - Access Key of your Application.
    • secret_key - Secret key of your Application
    • extend - Token will expire on subscription end date.

 

 

If "extend" parameter is not used, Then the generated token will expire in 1 hour

 

Response

  • status: Response status. if api request was sucessful, you will get a status ok, or error. If a error is returned, check the response
  • response.token: access token.
  • response.expires: access token expire timestamp.

 

Making Your First Request

It's very easy to start using the EntitySport Cricket API. By passing your token as token to our api server, you can get access to our API data instantly.

  https Request

GET https://rest.entitysport.com/v2/?token=[ACCESS_TOKEN]

Reference properties

Parameter Value Description
api_doc string Api Document
status_codes array Status Codes

Status codes properties

Parameter Value Description
ok string A successfull response
error string if the request contains error
invalid string if there is some mistake in request
unauthorized string if the request is not authorized, usually for invalid/expired access token
noaccess string No access to requested resource
curl -X GET
                                  "https://rest.entitysport.com/v2/?token=ec471071441bb2ac538a0ff901abd249"
                                
Response
{
    "status": "ok",
    "response": {
        "api_doc": "http://doc.entitysport.com/",
        "status_codes": {
            "ok": "Success",
            "error": "Failure",
            "invalid": "Invalid Request",
            "unauthorized": "Un authorized",
            "noaccess": "No access to requested resource"
        }
    },
    "api_version": "3.0"
}
Https Status Code

All API request will resolve with any of the following https header status.

Response code 

Description 

 

200 

API request valid, informations ready to access 

 

304

API request valid, but data was not modified since last accessed (compared using Etag) 

 

400

Client side error. occurs for invalid request 

 

401

Occurs for unauthorized request 

 

501

Server side error. Internal server error, unable to process your request 

 

API Response

All successfull API request will return json output. The basic structure of data is available on all of the calls.

   Status - Possible Values are as follows:

Status

 Description

 

 ok

A successfull response 

 

 error

if the request contains error 

 

 unauthorized

if the request is not authorized, usually for invalid/expired access token 

 

 accessdenied

if your app try to access non permitted data 

 

 

  • response: contains the main data of the response. value can be string, number, array or object.
Pagination

 

 Parameter  

 Value 

Description 

 

Per_page 

Integer 

Number of item to list in each API request 

 

Paged

Integer 

Page Number for request

 

 

 

/?token=[ACCESS_TOKEN]&per_page=5&&paged=3  

 

API Objects

There are some informations that we call as OBJECT. A response can contain a single object, or multiple objects or no objects at all. It is important get famililar with our objects.

We have 7 Obejcts in total. A object is a set of data, which contains a unique identifier, and directly relates to other objects. ie: match object connects inning object, team object.

Each object has a unique identifier which start with the first character of object name, and id as suffix. ie: competition unique identified named as cid, for match it's mid, for player it's pid, for team, it's tid and for season - sid.

  • Season: A seaon is a year timeframe. ie: 2016, 2014-15 etc. Tournaments played between March to September is marked with current year as season name. From October - February, it is marked with cross year, four digit from current year, and 2 digit from next year, separated by a hyphen, ie: 2015-16.

  • Competition: Competition is a tour, or tournament, or throphy cup. A competition contains information matches, teams, player performance, table standings, season, dates, type, category etc

  • Round: Round act as a sub-competition of another competition. When a tournament demands group stage matches, or a tour contains different format matches (as series), we keep their data as round.

  • Match: Match is the core part of our api. A match makes connection between teams, competition, round, players and innings.

  • Inning: Inning hold single match inning data.

  • Team: A generic sports team, having a name, logo, country and type of team.

  • Player: A generic sports player.