-
Notifications
You must be signed in to change notification settings - Fork 1
Data API
Khor Philemon edited this page Aug 29, 2020
·
5 revisions
Gets the total active COVID-19 cases of each state and district in Malaysia.
GET https://knowyourzone.xyz/api/data/covid19/latest
|
---|
100
requests per 15-minute
window.
See the rate limit documentation for details on determining your current rate limit status.
This endpoint doesn't have any parameters yet. (Will support query parameters in future releases)
curl -i -X GET https://knowyourzone.xyz/api/data/covid19/latest
If successful, this endpoint returns a 200
with the following response body:
{
"states": [
{
"name": "Sarawak",
"total": 12,
"districts": [
{
"name": "District with most active cases in Sarawak",
"total": 8
},
{
"name": "District with second most active cases",
"total": 4
},
...
]
},
{
"name": "Kuala Lumpur",
"total": 4,
"districts": [
{
"name": "District with most active cases in Kuala Lumpur",
"total": 4
},
{
"name": "This district has no active cases",
"total": 0
},
...
]
},
...
],
"last_updated": 1594785600
}
If no data is available at the moment, a 404
will be returned with the following response body:
{
"message": "Data currently unavailable"
}
Field | Type | Description |
---|---|---|
states |
array |
A list of state objects. A normal response will have 16 state objects (13 states + 3 federal territories) in its states field. In the event of missing data, a response may have fewer state objects. |
last_updated |
timestamp |
The time at which the data is updated in UTC epoch seconds. |
A state object encapsulates the data of a state. It contains the following 3 fields:
Field | Type | Description |
---|---|---|
name |
string |
The name of the state or federal territory. |
total |
integer |
The number of total active COVID-19 cases in the corresponding state. It is the sum of active cases in all districts, excluding import cases. |
districts |
array |
A list of district objects that describes the districts within the corresponding state. |
A district object encapulates the data of a district that belongs to the parent state object. It contains the following 2 fields:
Field | Type | Description |
---|---|---|
name |
string |
The name of the district. |
total |
integer |
The number of total active COVID-19 cases in the corresponding district. |