You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> This is a fast (< 200ms) and basic API for tracking development of the new coronavirus (COVID-19, SARS-CoV-2). It's written in python using 🍼 Flask. Supports multiple sources!
1
+
## Coronavirus Tracker API
2
+
Provides up-to-date data about Coronavirus outbreak. Includes numbers about confirmed cases, deaths and recovered.
Currently 2 different data-sources are available to retrieve the data:
24
24
25
-
All requests must be made to the base url: ``https://coronavirus-tracker-api.herokuapp.com/v2/`` (e.g: https://coronavirus-tracker-api.herokuapp.com/v2/locations). You can try them out in your browser to further inspect responses.
25
+
***jhu** - https://github.com/CSSEGISandData/COVID-19 - Worldwide Data repository operated by the Johns Hopkins University Center for Systems Science and Engineering (JHU CSSE).
26
26
27
-
### Picking data source
27
+
***csbs** - https://www.csbs.org/information-covid-19-coronavirus - U.S. County data that comes from the Conference of State Bank Supervisors.
28
28
29
-
We provide multiple data-sources you can pick from, simply add the query parameter ``?source=your_source_of_choice`` to your requests. JHU will be used as a default if you don't provide one.
29
+
__jhu__data-sourcewill be used as a default source if you don't specify a *source parameter* in your request.
30
30
31
-
#### Available sources:
32
31
33
-
***jhu** - https://github.com/CSSEGISandData/COVID-19 - Data repository operated by the Johns Hopkins University Center for Systems Science and Engineering (JHU CSSE).
32
+
## API Reference
34
33
35
-
***csbs** - https://www.csbs.org/information-covid-19-coronavirus - U.S. County data that comes from the Conference of State Bank Supervisors.
34
+
All endpoints are located at ``coronavirus-tracker-api.herokuapp.com/v2/`` and are accessible via https. For instance: you can get data per location by using this URL:
| source | The data-source where data will be retrieved from.<br>__Value__ can be: *jhu/csbs*. __Default__ is *jhu*| String |
147
+
| country_code | The ISO ([alpha-2 country_code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)) to the Country/Province for which you're calling the Endpoint | String |
148
+
| timelines | To set the visibility of timelines (*daily tracking*).<br>__Value__ can be: *0/1*. __Default__ is *0* (timelines are not visible) | Integer |
149
+
150
+
__Sample response__
57
151
```json
58
152
{
59
153
"latest": {
@@ -98,54 +192,76 @@ GET /v2/locations
98
192
}
99
193
```
100
194
101
-
Additionally, you can also filter by any attribute, including province and country ([alpha-2 country_code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
| {latest} | The total amount of confirmed cases, deaths and recovered for all the locations | Object |
199
+
| {latest}/confirmed | The up-to-date total number of confirmed cases for all the locations within the data-source | Integer |
200
+
| {latest}/deaths | The up-to-date total amount of deaths for all the locations within the data-source | Integer |
201
+
| {latest}/recovered | The up-to-date total amount of recovered for all the locations within the data-source | Integer |
202
+
| {locations} | The collection of locations contained within the data-source | Object |
203
+
| {location} | Information that identifies a location | Object |
204
+
| {latest} | The amount of confirmed cases, deaths and recovered related to the specific location | Object |
205
+
| {locations}/{location}/{latest}/confirmed | The up-to-date number of confirmed cases related to the specific location | Integer |
206
+
| {locations}/{location}/{latest}/deaths | The up-to-date number of deaths related to the specific location | Integer |
207
+
| {locations}/{location}/{latest}/recovered | The up-to-date number of recovered related to the specific location | Integer |
208
+
| {locations}/{location}/id | The location id. This unique id is assigned to the location by the data-source. | Integer |
209
+
| {locations}/{location}/country | The Country name | String |
210
+
| {locations}/{location}/country_code | The [ISO alpha-2 country_code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) Country code for the location. | String |
211
+
| {locations}/{location}/province | The province where the location belongs to. (Used for US locations coming from __csbs data-source__.<br>__Empty__ when *jhu data-source* is used | String |
212
+
| {locations}/{location}/{coordinates}/latitude | The location latitude | Float |
213
+
| {locations}/{location}/{coordinates}/longitude | The location longitude | Float |
214
+
215
+
216
+
### Example Requests with parameters
217
+
218
+
__Parameter: country_code__
219
+
220
+
Getting data for the Country specified by the *country_code parameter*, in this case Italy - IT
105
221
106
-
Include timelines.
107
222
```http
108
-
GET /v2/locations?timelines=1
223
+
GET /v2/locations?country_code=IT
109
224
```
110
225
111
-
### Getting a specific location (includes timelines by default).
112
-
```http
113
-
GET /v2/locations/:id
114
-
```
226
+
__Sample Response__
115
227
```json
116
228
{
117
-
"location": {
118
-
"id": 39,
119
-
"country": "Norway",
120
-
"country_code": "NO",
121
-
"province": "",
122
-
"last_updated": "2020-03-21T06:59:11.315422Z",
123
-
"coordinates": { },
124
-
"latest": { },
125
-
"timelines": {
126
-
"confirmed": {
127
-
"latest": 1463,
128
-
"timeline": {
129
-
"2020-03-16T00:00:00Z": 1333,
130
-
"2020-03-17T00:00:00Z": 1463
229
+
"latest": {
230
+
"confirmed": 59138,
231
+
"deaths": 5476,
232
+
"recovered": 7024
233
+
},
234
+
"locations": [
235
+
{
236
+
"coordinates": {
237
+
"latitude": "43",
238
+
"longitude": "12"
239
+
},
240
+
"country": "Italy",
241
+
"country_code": "IT",
242
+
"id": 16,
243
+
"last_updated": "2020-03-23T13:32:23.913872Z",
244
+
"latest": {
245
+
"confirmed": 59138,
246
+
"deaths": 5476,
247
+
"recovered": 7024
248
+
},
249
+
"province": ""
131
250
}
132
-
},
133
-
"deaths": { },
134
-
"recovered": { }
135
-
}
136
-
}
251
+
]
137
252
}
138
253
```
139
254
140
-
Exclude timelines.
141
-
```http
142
-
GET /v2/locations?timelines=0
143
-
```
255
+
__Parameter: source__
256
+
257
+
Getting the data from the data-source specified by the *source parameter*, in this case [csbs](https://www.csbs.org/information-covid-19-coronavirus)
258
+
144
259
145
-
### Getting US per county information.
146
260
```http
147
261
GET /v2/locations?source=csbs
148
262
```
263
+
264
+
__Sample Response__
149
265
```json
150
266
{
151
267
"latest": {
@@ -194,6 +310,23 @@ GET /v2/locations?source=csbs
194
310
}
195
311
```
196
312
313
+
__Parameter: timelines__
314
+
315
+
Getting the data for all the locations including the daily tracking of confirmed cases, deaths and recovered per location.
316
+
317
+
```http
318
+
GET /v2/locations?timelines=1
319
+
```
320
+
Explore the response by opening the URL in your browser [https://coronavirus-tracker-api.herokuapp.com/v2/locations?timelines=1](https://coronavirus-tracker-api.herokuapp.com/v2/locations?timelines=1) or make the following curl call in your terminal:
0 commit comments