API v2
How to use API (v2)
Send a request to the follwing URLs:
Request (GET) | Description | Examples |
---|---|---|
http://localhost/v2/current | Get all data from all the reportedly affected countries (List of Object) | Get current data |
http://localhost/v2/total | Get the total numbers of Confirmed, Deaths, and Recovered | Get total data |
http://localhost/v2/confirmed | Get the total number of Confirmed cases | Get confirmed cases |
http://localhost/v2/deaths | Get the total number of Deaths | Get deaths |
http://localhost/v2/recovered | Get the total number of Recovered cases | Get recovered cases |
http://localhost/v2/active | Get the total number of Active cases (Excluding Deaths and Recovered) | Get active cases |
http://localhost/v2/country/china | Search a country by a key name (*space may be needed) | Get a country data (keyname) |
http://localhost/v2/country/kr | Search a country by an [ISO country code (alpha2)] | Get a country data (ISO country code) |
http://localhost/v2/timeseries/global | Get the time series: global | Get time series |
http://localhost/v2/timeseries/{case} | Get the time series: confirmed, deaths, recovered | Get time series |
http://localhost/v2/timeseries/US/{case} | Get the time series (US): confirmed, deaths | Get time series (US) |
http://localhost/v2/current/US | Get all data from USA's current situation (List of Object) | Get current (US) |
Examples API (v2)
Get current data
http://localhost/v2/current
{
"data": [
{
"location": "US",
"confirmed": 28605669,
"deaths": 513091,
"recovered": 0,
"active": 28092578
},
{
"location": "India",
"confirmed": 11112241,
"deaths": 157157,
"recovered": 10786452,
"active": 168632
},
],
"dt": "2020-03-24 23:41:50",
"ts": 1585064510
}
Get total data
http://localhost/v2/total
{
"data": {
"confirmed": 417966,
"deaths": 18615,
"recovered": 107705,
"active": 236306
},
"dt": "2020-03-24 23:41:50",
"ts": 1585064510
}
Get confirmed cases
http://localhost/v2/confirmed
{
"data": {
"confirmed": 114067979
},
"dt": "2020-03-24 23:41:50",
"ts": 1585064510
}
Get deaths
http://localhost/v2/deaths
{
"data": {
"deaths": 2530716
},
"dt": "2020-03-24 23:41:50",
"ts": 1585064510
}
Get recovered cases
http://localhost/v2/recovered
{
"data": {
"recovered": 64418462
},
"dt": "2020-03-24 23:41:50",
"ts": 1585064510
}
Get active cases
http://localhost/v2/recovered
{
"data": {
"active": 47118031
},
"dt": "2020-03-24 23:41:50",
"ts": 1585064510
}
Get a country data
http://localhost/v2/country/th
{
"data":{
"location": "Thailand",
"confirmed": 827,
"deaths": 4,
"recovered": 52,
"active": 771
},
"dt": "2020-03-24 23:41:50",
"ts": 1585064510
}
http://localhost/v2/country/united%20kingdom
{
"data":{
"location": "United Kingdom",
"confirmed": 8164,
"deaths": 423,
"recovered": 140,
"active": 7601
},
"dt": "2020-03-24 23:41:50",
"ts": 1585064510
}
Get time series
http://localhost/v2/timeseries/global
{
"data": [
{
"1/22/20": {
"confirmed": 555,
"deaths": 17,
"recovered": 0
}
},
{
"1/23/20": {
"confirmed": 654,
"deaths": 18,
"recovered": 0
}
}],
"dt": "2020-03-25 23:37:49",
"ts": 1585150669
}
http://localhost/v2/timeseries/confirmed
{
"data": [
{
"Province_State": "",
"Country_Region": "Afghanistan",
"Coordinates": {
"Lat": 33,
"Long": 65
},
"TimeSeries": [
{
"date": "1/22/20",
"value": 0
},
{
"date": "1/23/20",
"value": 0
}]
}],
"dt": "2020-03-25 23:37:49",
"ts": 1585150669
Get time series (US)
http://localhost/v2/timeseries/US/confirmed
{
"data": [
{
"Province_State":"American Samoa",
"Country_Region":"US",
"Info": {
"UID":16,
"iso2":"AS",
"iso3":"ASM",
"code3":16,
"FIPS":60.0,
"Admin2":""
},
"Coordinates":{
"Lat":-14.270999999999999,
"Long":-170.132
},
"TimeSeries":[
{"date":"1/22/20","value":0},
{"date":"1/23/20","value":0},
{"date":"1/24/20","value":0}]}
],
"dt":"2020-04-05 23:13:44",
"ts":1586099624.0
}
Get current (US)
http://localhost/v2/current/US
{
"data": [
{
"Province_State": "New York",
"Confirmed": 312977,
"Deaths": 24198,
"Recovered": 57540,
"Active": 231239
},
{
"Province_State": "New Jersey",
"Confirmed": 123717,
"Deaths": 7742,
"Recovered": 15642,
"Active": 100333
}],
"dt":"2020-04-05 23:13:44",
"ts":1586099624.0
}