Do you wish to have access to live Covid-19 related statistics for your application or website? The Coronavirus Map API can come to your rescue!
Amidst the ongoing pandemic, data analytics has formed the backbone of the Covid-19 response at an international level. Predictive analysis backed by statistical data has found great significance in planning and implementation of evolving governance policies in the current times. Government authorities around the world have rapidly adapted to leverage and rely on real-time dashboards for informed decision making. The dashboards aim to comprehensively depict the Covid-19 related situation in real-time, in the form of statistics at a granular region-specific scale. Another important aspect that such dashboards focus on is the consolidation of data from different region-specific sources in addition to visualization of such information-rich data in an intuitive manner. Thus such interfaces strive to present the ongoing situation in real-time through actionable insights with the end goal of assisting the authorities towards mitigating the spread of infections among the populace.
As the situation evolves, in the background of the lockdowns and quarantine measures imposed around the world, it is envisaged that such real-time dashboards would continue to serve as a crucial tool towards planning and mitigating the spread of Covid-19 globally. Under the hood, such dashboards rely on REST-based APIs that consolidate and serve Covid-19 related statistical data from different sources. Numerous such APIs that serve region-specific Covid-19 related numerical data are available for use.
In this article, we will be discussing the Coronavirus Map API. The API has been developed to provide free COVID-19 live updates to its users.
What is the Coronavirus Map API?
The Coronavirus Map API is a REST based API service that facilitates programmatically access to live Covid-19 updates in the form of current and historical data to render maps, charts and graphs. Covid-19 related data provided by the API includes number of cases per day, week, month, year – change per day in addition to difference and summary for the user input region. It also provides access to the total and active number of cases including number of deaths, recovered and % ratio.
How does the Coronavirus Map API work?
The Coronavirus Map API consolidates data related to Covid-19 from different sources and provides REST-based programmatic access to it based on user query involving regions and/or temporal information specified. The API maintained by @QUARcountry, quarantine.country & H7, claims to employ a methodology to verify, detect and avoid passing wrong data to its users. The API returns Covid-19 related reports in the form of statistics for the parameters – “total_cases
”, “active_cases
”, “deaths
”, “recovered
”, “critical
”, “tested
”, “death_ratio
” and “recovered_ratio
”.
Who is the Coronavirus Map API for exactly?
The Coronavirus Map API is intended to serve application developers and web developers and also startups and enterprises – who are looking to integrate a reliable service that provides access to live Covid-19 related statistical information in their application or website. The API primarily caters to developers of apps and services in the e-governance and data visualization space. The API is freely available for developers and enterprises.
How to connect to the Coronavirus Map API Tutorial
The following is a step-by-step tutorial for connecting to the Coronavirus Map API.
Step 1: Sign Up on RapidAPI
A RapidAPI account is required to connect to the Coronavirus Map API. You can sign up for a RapidAPI account by navigating to the RapidAPI website and clicking on the Sign-Up button at the top right!
RapidAPI supports signing up using Google, Github, or Facebook.
Step 2: Testing Connection to the Coronavirus Map API
Having signed up and logged in to RapidAPI, you would need to navigate to the Coronavirus Map API page on the RapidAPI platform to connect to the API.
To test API connection, please navigate to the “Report by Region” endpoint under “Summary” under the Endpoints Panel on the left. Please click on the “Test Endpoint” button. A successful connection would result in a “200 OK” response in the Results tab on this page.
Now that you have connected and tested the connection to the Coronavirus Map API , let’s learn more about its usage!
Endpoints of the Coronavirus Map API
The Coronavirus Map API has nine endpoints broadly classified into three categories – “List All Regions”, “Summary” and “Charts/Spots” to facilitate programmatic access to Covid-19 statistical data. The endpoints with the relevant information on their usage are as follows:
List All Regions
The endpoint lists all the supported regions by the Coronavirus Map API
List All Regions
The endpoint does not require any input parameter. The API response returns a list of regions supported by the Coronavirus Map API.
Summary
This class of endpoints returns the latest statistical data summarizing the Covid-19 situation based on the user input region.
Report by Region
This endpoint facilitates access to latest report of the coronavirus for the user input “region
” string. This endpoint requires one parameter:
- “
region
” – indicating the region of interest for which the Covid-19 summary report is to be returned.
- “
The API response contains “summary
” and “change
” lists each containing – “total_cases
”, “active_cases
”, “deaths
”, “recovered
”, “critical
”, “tested
”, “death_ratio
” and “recovered_ratio
” for the corresponding input parameter – “region
” string.
Latest Report
This endpoint facilitates access to latest report of the coronavirus for the world. This endpoint does not require any input parameter.
The API response contains “summary
” and “change
” lists each containing – “total_cases
”, “active_cases
”, “deaths
”, “recovered
”, “critical
”, “tested
”, “death_ratio
” and “recovered_ratio
” for the world.
Charts/Spots
All Spots for Summary
This endpoint facilitates access to all known case spots of world summary report.
The API response contains a list consisting of – “total_cases
”, “active_cases
”, “deaths
”, “recovered
”, “critical
”, “tested
”, “death_ratio
” and “recovered_ratio
” for each date for which the data is available.
All Spots for Region
This endpoint facilitates access to all known case spots for the user input region of interest. This endpoint requires one parameter:
- “
region
” – indicating the region of interest for which the Covid-19 report is to be returned.
- “
The API response contains a list consisting of – “total_cases
”, “active_cases
”, “deaths
”, “recovered
”, “critical
”, “tested
”, “death_ratio
” and “recovered_ratio
” for each date for which the data is available, for the user input region of interest.
Change during the Year
This endpoint facilitates access to spots for last 365 days from the user input date (with a 15 day interval), for the user input region of interest. This endpoint requires two parameters:
- “
region
” – indicating the region of interest for which the Covid-19 report is to be returned. - “
date
” – indicating the last spot date from which the 365 days spot data is to be returned. This parameter is optional. If not set, 365 days spot data from the current date is returned.
- “
The API response contains a list consisting of – “total_cases
”, “active_cases
”, “deaths
”, “recovered
”, “critical
”, “tested
”, “death_ratio
” and “recovered_ratio
”, for each date (with an interval of 15 days) for the last 365 days from the user input date, for the user input region of interest.
Change during the Month
This endpoint facilitates access to all spots for the last month from the user input date, for the user input region of interest. This endpoint requires two parameters:
- “
region
” – indicating the region of interest for which the Covid-19 report is to be returned. - “
date
” – indicating the last spot date from which the last month spot data is to be returned. This parameter is optional. If not set, last month spot data from the current date is returned.
- “
The API response contains a list consisting of – “total_cases
”, “active_cases
”, “deaths
”, “recovered
”, “critical
”, “tested
”, “death_ratio
” and “recovered_ratio
”, for each date for the last month from the user input date, for the user input region of interest.
Change during the Week
This endpoint facilitates access to all spots for the last week from the user input date, for the user input region of interest. This endpoint requires two parameters:
- “
region
” – indicating the region of interest for which the Covid-19 report is to be returned. - “
date
” – indicating the last spot date from which the last week spot data is to be returned. This parameter is optional. If not set, last week spot data from the current date is returned.
- “
The API response contains a list consisting of – “total_cases
”, “active_cases
”, “deaths
”, “recovered
”, “critical
”, “tested
”, “death_ratio
” and “recovered_ratio
”, for each date for the last week from the user input date, for the user input region of interest.
Change during the Day
This endpoint facilitates access to all spots for the user input date, for the user input region of interest. This endpoint requires two parameters:
- “
region
” – indicating the region of interest for which the Covid-19 report is to be returned. - “
date
” – indicating the spot date for which data is to be returned. This parameter is optional. If not set, the spot data for the current date is returned.
- “
The API response contains a list consisting of – “total_cases
”, “active_cases
”, “deaths
”, “recovered
”, “critical
”, “tested
”, “death_ratio
” and “recovered_ratio
”, for the user input date, for the user input region of interest.
How to use the Coronavirus Map API with Python?
The following code snippet depicts the use of Coronavirus Map API with Python. It uses the “requests” library to send a GET request to the endpoint with the parameter “region” specified in the “querystring” dictionary.
The “x-rapidapi-key
” value in the “headers” dictionary would need to be replaced with your actual key which can be obtained from the Coronavirus Map API page in the Header Parameters section.
import requests url = "https://coronavirus-map.p.rapidapi.com/v1/summary/region" querystring = {"region":"usa"} headers = { 'x-rapidapi-key': "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", 'x-rapidapi-host': "coronavirus-map.p.rapidapi.com" } response = requests.request("GET", url, headers=headers, params=querystring) print(response.text)
How to use the Coronavirus Map API with PHP?
The following code snippet depicts the use of Coronavirus Map API with PHP. It uses the “curl” function of PHP to send a GET request to the endpoint with the parameter “region” specified in the “CURLOPT_URL”.
The “x-rapidapi-key
” value in the “CURLOPT_HTTPHEADER” object would need to be replaced with your actual key which can be obtained from the Coronavirus Map API page in the Header Parameters section.
<?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://coronavirus-map.p.rapidapi.com/v1/summary/region?region=usa", CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => [ "x-rapidapi-host: coronavirus-map.p.rapidapi.com", "x-rapidapi-key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { echo $response; }
How to use the Coronavirus Map API with Ruby?
The following code snippet depicts the use of Coronavirus Map API with Ruby. The “x-rapidapi-key
” value in the “request” object would need to be replaced with your actual key which can be obtained from the Coronavirus Map API page in the Header Parameters section.
require 'uri' require 'net/http' require 'openssl' url = URI("https://coronavirus-map.p.rapidapi.com/v1/summary/region?region=usa") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Get.new(url) request["x-rapidapi-key"] = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' request["x-rapidapi-host"] = 'coronavirus-map.p.rapidapi.com' response = http.request(request) puts response.read_body
How to use the Coronavirus Map API with JavaScript?
The following code snippet depicts the use of Coronavirus Map API with JavaScript. It uses JQuery’s “ajax” function to send a GET request to the endpoint with the parameters specified in the “settings” object.
The “x-rapidapi-key
” value in the “headers” object would need to be replaced with your actual key which can be obtained from the Coronavirus Map API page in the Header Parameters section.
const settings = { "async": true, "crossDomain": true, "url": "https://coronavirus-map.p.rapidapi.com/v1/summary/region?region=usa", "method": "GET", "headers": { "x-rapidapi-key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "x-rapidapi-host": "coronavirus-map.p.rapidapi.com" } }; $.ajax(settings).done(function (response) { console.log(response); });
Alternatives to the Coronavirus Map API
A few alternatives APIs that provide access to Covid-19 statistics similar to the Coronavirus Map API are:
- COVID-19 data
- This API facilitates Covid-19 related country specific statistics at an update interval of 15 minutes.
- Covid-19
- This API provides total, incremental and time-series Covid-19 numbers across continents, countries and states, updated on a daily basis.
- COVID-19
- This API enables free access to statistics for all countries about COVID-19.
- COVID-19 Statistics
- This API facilitates access to statistics from public data by Johns Hopkins CSSE.
Benefits of the Coronavirus Map API
The Coronavirus Map API empowers its users by providing programmatic access to live Covid-19 related statistical information. This information is crucial in understanding the dynamics of the Covid-19 spread at both macro as well as micro scale. Visualizing such information in the form of intuitive dashboards with graphs, charts and maps can help authorities and policy makers monitor the Covid-19 situation in real-time. The Coronavirus Map API can also be used by researchers to study, analyze and develop predictive models to predict the virus spread over time over specific regions. Thus the API can aid health-care researchers and policy advisors around the world to suggest appropriate preventive measures in a timely manner, thereby resulting in informed decision making towards mitigating the virus spread.
Summary
The Coronavirus Map API is a powerful tool for app and web developers, intended for seamless integration of live Covid-19 related statistical information in their application or website. The API facilitates programmatic access to current as well as historical region-specific numerical data such as active cases, number of deaths, number of recovered cases, ratio in %, etc., based on the user requested parameters. The API thus caters to developers and enterprises working towards developing tools for e-governance and public healthcare. It is envisaged that such APIs that provide live Covid-19 related statistics would continue to play an integral role towards development of real-time intuitive dashboards for assisting authorities in monitoring and mitigating the virus spread.
Leave a Reply