Skip to content

Commit 7797aa8

Browse files
committed
Samples per parameters added
1 parent a2d4a3c commit 7797aa8

File tree

1 file changed

+55
-15
lines changed

1 file changed

+55
-15
lines changed

README.md

Lines changed: 55 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Support multiple data-sources.
1919
![Covid-19 Deaths](https://covid19-badges.herokuapp.com/deaths/latest)
2020

2121

22-
## API Endpoints
22+
## API Reference
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``
@@ -35,7 +35,9 @@ Currently 2 different data-sources are available to retrieve the data:
3535

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

38-
__JHU__ data-source will be used as a default source if you don't specify a source parameter in your request.
38+
__jhu__ data-source will be used as a default source if you don't specify a source parameter in your request.
39+
40+
## API Endpoints
3941

4042
### Latest Endpoint
4143

@@ -61,20 +63,23 @@ __Query String Parameters__
6163
| ---------------------- | -------------------------------------------------------------------------------- | ------ |
6264
| source | The data-source where data will be retrieved from *(jhu/csbs)*. Default is *jhu* | String |
6365

66+
6467
### Locations Endpoint
6568

6669
Getting latest amount of total confirmed cases, deaths, and recoveries per location.
6770

71+
#### The Location Object
6872
```http
69-
GET /v2/locations/{locationId}
73+
GET /v2/locations/:id
7074
```
7175

7276
__Path Parameters__
7377
| Path parameter | Required/Optional | Description | Type |
7478
| -------------- | ----------------- | ------------------------------------------------------------------ | ------- |
75-
| locationId | OPTIONAL | The location id for which you want to call the locations Endpoint. | Integer |
79+
| id | OPTIONAL | The location id for which you want to call the locations Endpoint. | Integer |
7680

7781

82+
#### Example Request
7883
```http
7984
GET /v2/locations/39
8085
```
@@ -104,6 +109,7 @@ __Sample response__
104109
}
105110
```
106111

112+
#### List of all locations
107113
```http
108114
GET /v2/locations
109115
```
@@ -182,26 +188,52 @@ __Response definitions__
182188
| {locations}/{location}/{coordinates}/longitude | The location longitude | Float |
183189

184190

185-
```http
186-
GET /v2/locations?country_code=US
187-
```
191+
### Example Requests with parameters
192+
193+
__Parameter: country_code__
194+
Getting data for the Country specified by the *country_code parameter*, in this case Italy - IT
188195

189196
```http
190-
GET /v2/locations?timelines=1
197+
GET https://coronavirus-tracker-api.herokuapp.com/v2/locations?country_code=IT
191198
```
192199

193-
### Getting a specific location (includes timelines by default).
194-
195-
196-
Exclude timelines.
197-
```http
198-
GET /v2/locations?timelines=0
200+
__Sample Response__
201+
```json
202+
{
203+
"latest": {
204+
"confirmed": 59138,
205+
"deaths": 5476,
206+
"recovered": 7024
207+
},
208+
"locations": [
209+
{
210+
"coordinates": {
211+
"latitude": "43",
212+
"longitude": "12"
213+
},
214+
"country": "Italy",
215+
"country_code": "IT",
216+
"id": 16,
217+
"last_updated": "2020-03-23T13:32:23.913872Z",
218+
"latest": {
219+
"confirmed": 59138,
220+
"deaths": 5476,
221+
"recovered": 7024
222+
},
223+
"province": ""
224+
}
225+
]
226+
}
199227
```
200228

201-
### Getting US per county information.
229+
__Parameter: source__
230+
Getting the data from the data-source (csbs)[https://www.csbs.org/information-covid-19-coronavirus]
231+
202232
```http
203233
GET /v2/locations?source=csbs
204234
```
235+
236+
__Sample Response__
205237
```json
206238
{
207239
"latest": {
@@ -250,6 +282,14 @@ GET /v2/locations?source=csbs
250282
}
251283
```
252284

285+
__Parameter: timelines__
286+
Getting the data for all the locations including the daily tracking of confirmed cases, deaths and recovered
287+
288+
```http
289+
GET https://coronavirus-tracker-api.herokuapp.com/v2/locations?timelines=1
290+
```
291+
__NOTE:__ Timelines tracking starts from day 22nd January 2020 and ends to the last available day on the data-source.
292+
253293
## Wrappers
254294

255295
These are the available API wrappers created by the community. They are not necessarily maintained by any of this project's authors or contributors.

0 commit comments

Comments
 (0)