How to get Injury- Football API sample code
Posted on July 05, 2020
Share the sample code using the interface call of iSports Api Sports Data www.isportsapi.com. This API endpoint returns the injury list of the past 8 hours and the coming 2 days.
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class SportDemo {
public static void main(String[] args) {
// Set url parameter
String url = "http://api.isportsapi.com/sport/football/injury?api_key=<YOUR_API_KEY>";
// Call iSport Api to get data in json format
String charset = "UTF-8";
String jsonResult = get(url, charset);
System.out.println(jsonResult);
}
/**
* @param url
* @param charset
* @return return json string
*/
public static String get(String url, String charset) {
BufferedReader reader = null;
String result = null;
StringBuffer sbf = new StringBuffer();
String userAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36";
try {
URL newUrl = new URL(url);
HttpURLConnection connection = (HttpURLConnection)newUrl.openConnection();
connection.setRequestMethod("GET");
connection.setReadTimeout(30000);
connection.setConnectTimeout(30000);
connection.setRequestProperty("User-agent", userAgent);
connection.connect();
InputStream is = connection.getInputStream();
reader = new BufferedReader(new InputStreamReader(is, charset));
String strRead = null;
while ((strRead = reader.readLine()) != null) {
sbf.append(strRead);
sbf.append("\r\n");
}
reader.close();
result = sbf.toString();
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
}
The football API returns the data as follows:
{
"code": 0,
"message": "success",
"data": [
{
"matchId": "372967618",
"teamId": "469",
"playerId": "74917",
"name": "Rodolfo Alves de Melo",
"reasonType": 34,
"reason": "Red card Suspended"
},
{
"matchId": "372967618",
"teamId": "4175",
"playerId": "47948",
"name": "Ebert Willian Amancio, Betao",
"reasonType": 34,
"reason": "Red card Suspended"
},
{
"matchId": "372967618",
"teamId": "469",
"playerId": "144472",
"name": "Yuri Oliveira Lima",
"reasonType": 56,
"reason": "Yellow card total suspension"
},
{
"matchId": "372967618",
"teamId": "4175",
"playerId": "168895",
"name": "Daniel Amorim Dias da Silva",
"reasonType": 71,
"reason": "Muscle Injury"
},
{
"matchId": "372967618",
"teamId": "469",
"playerId": "154154",
"name": "Matheus Mascarenhas Dos Santos Raimundo",
"reasonType": 99,
"reason": "injured"
},
{
"matchId": "372967618",
"teamId": "4175",
"playerId": "121691",
"name": "Alex da Silva",
"reasonType": 99,
"reason": "injured"
},
{
"matchId": "372967618",
"teamId": "469",
"playerId": "113390",
"name": "Matheus Ferraz Pereira",
"reasonType": 128,
"reason": "Ruptured knee ligament"
},
{
"matchId": "372967618",
"teamId": "469",
"playerId": "150802",
"name": "Pedro Guilherme Abreu dos Santos",
"reasonType": 131,
"reason": "Thigh problems"
}
]
}
Recommended Reading

How to get Lineups - Football API sample code
Share the sample code using the interface call of iSports Api Sports Data www.isportsapi.com. This API endpoint returns the lineups of the specified match. If some matches have no lineups or no specific formations, then the player position will return 0. java import java.io.BufferedReader; import

Sports Data Feed—Fast, Reliable and Accurate iSports API
iSports API is a REAL-TIME SPORTS DATA FOR GAMING, MEDIA & BEYOND. In order to improve your Brand Reputation, iSports provides The Fastest Sports Odds data API service. Our odds API service provides access to more than 100 different bookmakers easily, to check, verify and process your offer in real

How to collect correct score data in football match?
To correctly predict which team will win or lose is not an impossible task in many cases, as even at the highest level there are definitely mismatches. However, the reason we all still love football is that anything can happen! There’s no foolproof way to predict a winner, loser or a draw, and it’s