API Reference - version 1.0.0
There are four API Endpoints that Covindia is providing at the moment:
covindia-raw-data
covindia-history-district-data
covindia-present-general-data
covindia-present-state-data
It should be noted that these are all GET requests to be made at:
https://v1.api.covindia.com/api-endpoint
covindia-raw-data
This returns a JSON object that contains raw data (as defined below). You need this when the other end-points don't satisfy your need.
Table CRD.1 | |
---|---|
Key |
Description |
number (str) |
A string of a number which is the key to an object of type as described by Table CRD.2 |
Table CRD.2 | |
---|---|
Key |
Description |
`date` (str) |
(str) Date of case (either infected or death) as "DD/MM/YYYY" |
`time` (str) |
(str) Time of the report as "HH:MM". If this isn't known, it is usually the time of release of the source / entry. This shouldn't be taken as the time of the infection. |
`district` (str) |
(str) The name of the district according to the district list |
`state` (str) |
(str) The name of the state according to the state list |
`infected` (str) |
(int) The number of infected cases in this entry. |
`death` (str) |
(int) The number of deaths in this entry. |
`source` (str) |
(str) The source link for this entry. |
It is important to note that there may be multiple cases in a district in one day. Hence, all the values must be added up per date.
A GET request to covindia-raw-data
returns a JSON of this format:
{
"0" (str) : {
"date" (str) : "dd/mm/YYYY" (str),
"time" (str) : "HH:MM" (str),
"district" (str) : "district-name-0" (str),
"state" (str) : "state-name-0" (str),
"infected": infected (int),
"death" (str) : infected (int),
"source" (str) : "source-link-0" (str)
},
"1" (str) : {
"date" (str) : "dd/mm/YYYY" (str),
"time" (str) : "HH:MM" (str),
"district" (str) : "district-name-1" (str),
"state" (str) : "state-name-1" (str),
"infected": infected (int),
"death" (str) : infected (int),
"source" (str) : "source-link-1" (str)
},
...
}
covindia-history-district-data
This returns a JSON object that contains dates as keys and corresponding districts' data. You need this when you ask, "What districts were affected on these dates?".
Table CDDD.1 | |
---|---|
Key |
Description |
date (str) |
A string of the form "DD/MM/YYYY" which is the key to an object of type as described in Table CDDD.2 |
Table CDDD.2 | |
---|---|
Key |
Description |
district-name (str) |
Each district-name is a key to an object of type as decsribed in Table CDDD.3 |
Table CDDD.3 | |
---|---|
Key |
Description |
`infected` (str) | (int) The total number of infected cases in this district till date (cumulative) |
`death` (str) |
(int) The total number of deaths in this district till date (cumulative) |
A GET request to covindia-district-date-data
returns a JSON of this format:
{
"DD/MM/YYYY" (str) : {
"district-name-1" (str) : {
"infected" : infected-value (int)
"death" : death-value (int)
},
"district-name-2" (str) : {
"infected" : infected-value (int)
"death" : death-value (int)
},
...
},
"DD/MM/YYYY" (str) : {
"district-name-1" (str) : {
"infected" : infected-value (int)
"death" : death-value (int)
},
"district-name-2" (str) : {general-
"infected" : infected-value (int)
"death" : death-value (int)
},
...
}
}
covindia-present-general-data
This returns a JSON object that contains general data (as defined below).
Table CGD.1 | |
---|---|
Key |
Description |
`deathTotal` (str) |
(int) The total number of deaths until now. |
`districtList` (str) |
(array) An array containing strings where each string the name of a infected district. |
`infectedTotal` (str) |
(int) The total number of infected cases until now. |
`infectedMax` (str) |
(int) The maximum number of infected cases in a district across all districts. |
`lastUpdatedTime` (str) |
(str) A string representing the last updated time of the format " YYYY-mm-dd HH:MM:SS.ffffff " #. |
`statesList` (str) |
(array) An array containing strings where each string the name of an infected state |
`totalCured` (str) |
(int) The number of cured people until now. |
# It may be important to note that this string is the output of str(datetime.datetime.now())
in Python 3.6.9. To understand the directives, visit:
https://strftime.org/
A GET request to covindia-general-data
returns a JSON of this format:
{
"deathTotal" (str) : death-total (int),
"districtList" (str) : ["district-name-0" (str), "district-name-1" (str), ...] (array),
"infectedTotal" (str) : infected-total (int),
"infectedMax" (str) : infected-max (int),
"lastUpdatedTime" (str) : "YYYY-mm-dd HH:MM:SS.ffffff" (str),
"statesList" (str) : ["state-name-0" (str), "state-name-1" (str), ...] (array),
"totalCured" (str) : total-cured (int)
}
covindia-present-state-data
This returns a JSON object that contains states as keys along with the number of infected cases in that state. You need this when you ask "What are the number of cases in this state right now?"
Table CSD.1 | |
---|---|
Key |
Description |
state-name (str) |
(int) The total number of infected cases in this state. |
A GET request to covindia-state-data
returns a JSON of this format:
"state-name-0" : infected-number-0 (int),
"state-name-1" : infected-number-1 (int),
"state-name-2" : infected-number-2 (int),
...