Skip to content

Commit fcd4750

Browse files
committed
Latest and location endpoints work
1 parent 7ed908e commit fcd4750

File tree

1 file changed

+52
-12
lines changed

1 file changed

+52
-12
lines changed

README.md

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Coronavirus Tracker API
22
Provides up-to-date data about Coronavirus outbreak. Includes numbers about confirmed cases, deaths and recovered.
3-
Support multiple data sources.
3+
Support multiple data-sources.
44

55
![Travis build](https://api.travis-ci.com/ExpDev07/coronavirus-tracker-api.svg?branch=master)
66
[![License](https://img.shields.io/github/license/ExpDev07/coronavirus-tracker-api)](LICENSE.md)
@@ -19,30 +19,33 @@ Support multiple data sources.
1919
![Covid-19 Deaths](https://covid19-badges.herokuapp.com/deaths/latest)
2020

2121

22-
## Endpoints
22+
## API Endpoints
2323

2424
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:
2525
``https://coronavirus-tracker-api.herokuapp.com/v2/locations``
2626

2727
You can try to open the URL in your browser to further inspect the response.
2828

2929

30-
### Picking data source
30+
#### Available data-sources:
3131

32-
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.
32+
Currently 2 different data-sources are available to retrieve the data:
3333

34-
#### Available sources:
35-
36-
* **jhu** - https://github.com/CSSEGISandData/COVID-19 - Data repository operated by the Johns Hopkins University Center for Systems Science and Engineering (JHU CSSE).
34+
* **jhu** - https://github.com/CSSEGISandData/COVID-19 - Worldwide Data repository operated by the Johns Hopkins University Center for Systems Science and Engineering (JHU CSSE).
3735

3836
* **csbs** - https://www.csbs.org/information-covid-19-coronavirus - U.S. County data that comes from the Conference of State Bank Supervisors.
3937

40-
* **... more to come later**.
38+
__JHU__ data-source will be used as a default source if you don't specify a source parameter in your request.
39+
40+
### Latest Endpoint
41+
42+
Getting latest amount of total confirmed cases, deaths, and recoveries.
4143

42-
### Getting latest amount of total confirmed cases, deaths, and recoveries.
4344
```http
4445
GET /v2/latest
4546
```
47+
48+
__Sample response__
4649
```json
4750
{
4851
"latest": {
@@ -53,10 +56,20 @@ GET /v2/latest
5356
}
5457
```
5558

56-
### Getting all locations.
59+
__Parameters__
60+
| Query string parameter | Description | Type |
61+
| ---------------------- | -------------------------------------------------------------------------------- | ------ |
62+
| source | The data-source where data will be retrieved from *(jhu/csbs)*. Default is *jhu* | String |
63+
64+
### Locations Endpoint
65+
66+
Getting latest amount of total confirmed cases, deaths, and recoveries per location.
67+
5768
```http
5869
GET /v2/locations
5970
```
71+
72+
__Sample response__
6073
```json
6174
{
6275
"latest": {
@@ -100,13 +113,40 @@ GET /v2/locations
100113
]
101114
}
102115
```
116+
| Query string parameter | Description | Type |
117+
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------- |
118+
| source | The data-source where data will be retrieved from. __Value__ can be: __jhu/csbs__. |
119+
| __Default__ is __jhu__ | String |
120+
| 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 |
121+
| timelines | To set the visibility of timelines (*daily tracking*).__Value__ can be: __0/1__. __Default__ is __0__ | Integer |
122+
123+
124+
__Response definitions__
125+
| Response Item | Description | Type |
126+
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ------- |
127+
| {latest} | The total amount of confirmed cases, deaths and recoveries for all the locations | Object |
128+
| {latest}/confirmed | The up-to-date total number of confirmed cases for all the locations within the data-source | Integer |
129+
| {latest}/deaths | The up-to-date total amount of deaths for all the locations within the data-source | Integer |
130+
| {latest}/recovered | The up-to-date total amount of recovered for all the locations within the data-source | Integer |
131+
| {locations} | The collection of locations contained within the data-source | Object |
132+
| {location} | Information that identifies a location | Object |
133+
| {latest} | The amount of confirmed cases, deaths and recovered related to the specific location | Object |
134+
| {locations}/{location}/{latest}/confirmed | The up-to-date number of confirmed cases related to the specific location | Integer |
135+
| {locations}/{location}/{latest}/deaths | The up-to-date number of deaths related to the specific location | Integer |
136+
| {locations}/{location}/{latest}/deaths | The up-to-date number of recovered related to the specific location | Integer |
137+
| {locations}/{location}/id | The location id. This id number is assigned to the location by the data-source. | Integer |
138+
| {locations}/{location}/country | The Country name | String |
139+
| {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 |
140+
| {locations}/{location}/province | The province where the location belongs to. (Used only for __csbs data-source__ of US locations. __Empty__ with __jhu data-source__. | String |
141+
| {locations}/{location}/{coordinates}/latitude | The location latitude | Float |
142+
| {locations}/{location}/{coordinates}/longitude | The location longitude | Float |
143+
144+
103145

104-
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)).
105146
```http
106147
GET /v2/locations?country_code=US
107148
```
108149

109-
Include timelines.
110150
```http
111151
GET /v2/locations?timelines=1
112152
```

0 commit comments

Comments
 (0)