A simple Covid19 API

Nife Oluyemi
2 min readMar 26, 2020

Oh no! not another API

ABOUT

A simple web API endpoint for retrieving total corona virus cases by aggregate and stats from different locations (countries).

URL: https://covidapi.mybluemix.net

The API has the following endpoints which can be used to programmatically get the most recent aggregate covid19 cases:

  • Get all cases
  • Get all countries
  • Get total cases

MOTIVATION

With no avail after searching the web for a simple web api endpoint to retrieve corona virus related data in a clean format, I decided to create a simple API to help developers, data scientist, analyst, or hobbyists retrieve corona virus data to be used for different applications.

This was achieved by scraping data from the worldometer coronavirus update page, and parsing the data into a readable format with python.

Get all cases

Retrieve the current total global recorded cases with a list of locations and its respective total cases.

NB: Diamond Princess cruise ship included in list of locations.

GET: /api/v1/cases

RESPONSE

Status: 200 OK
{
"total": "471,304"
"deaths": "21,291"
"recovered": "114,642"
"active": "335,371"
"serious_critical": "14,792"
"locations": [
{
"location": "Afghanistan"
"total": "84"
"deaths": "2"
"recovered": "2"
"active": "80"
"serious_critical": "0"
}
....
]
}

Get all countries

Retrieve a list of countries and its current corona virus total data.

GET /api/v1/countries

RESPONSE

Status: 200 OK
[
{
"country": "Afghanistan",
"total": "84",
"deaths": "2",
"recovered": "2",
"active": "80",
"serious_critical": "0"
},
{
"country": "Albania",
"total": "146",
"deaths": "5",
"recovered": "17",
"active": "124",
"serious_critical": "3"
}
....
]

Get total cases

Retrieve total global recorded cases.

GET: /api/v1/cases/total

RESPONSE

Status: 200 OK
{
"total": "471,304"
"deaths": "21,291"
"recovered": "114,642"
"active": "335,371"
"serious_critical": "14,792"
}

Data source: https://www.worldometers.info/coronavirus

Tools: Python Flask, IBM Cloud Foundry

More features to come:

  • Get cases by date
  • Filter by country

Check the product out on Product Hunt: https://www.producthunt.com/posts/a-simple-covid-19-api

Let’s #stopthespread by following the tips from World Health Organization and other health officials to help contain the covid19 virus. Information is key in moments like this.

--

--

Nife Oluyemi

/neefeh/. Engineering @ Twitter. Seeking Focus. Passionate about Design, Development, Cloud Computing, Resume Editing, and BetterBrain. Views are mine.