Get Coronavirus COVID-19 Rest API for India Using RapidAPI

This tutorial helps to get covid affected state wise district areas of india. We are using RapiAPI to get the json Packet. Here we will generate request in multiple platform like Android, Java, PHP, NodeJs, Python, Shell.

Covid 19

Don't Miss

COVID-19 is the infectious disease caused by the most recently discovered coronavirus. This new virus and disease were unknown before the outbreak began in Wuhan, China, in December 2019. Now days, many countries affected by Coronavirus. India is also suffering from this infection diseases. Indian government provides stats of affected areas on Mohfow.gov.in.

Signup Rapid Account

We are going to use Rapid API, so need to create an account. Click here to signup account.
rapidSignup

Get RapidAPI-Key

Rapid API key automatically generated after your successful signup. Go to covid19india. Here we can get X-RapidAPI-Key. Also we get the API Covid 19 World Data Country Wise & Covid 19 India data State & District Wise. In this tutorial, we are going to explain Covid 19 India data State & District Wise API.
Covid_API_key

Subscribe Basic Plan

We need to subscribe basic plan to use API. Click on Subscribe To Test button. It redirect to plan page select Basic Plan. RapidApi provides free API for Covid-19.
Subscribe-API

ChoosePlan

Request Covid-19 Data Using Java / Android OkHttp

Use the below php code to fetch the Covid 19 India state & DIstrict Wise Data. Use your X-RapidAPI-Key in the curl request.

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
	.url("https://corona-virus-world-and-india-data.p.rapidapi.com/api_india")
	.get()
	.addHeader("x-rapidapi-host", "corona-virus-world-and-india-data.p.rapidapi.com")
	.addHeader("x-rapidapi-key", "YOUR_X-RapidAPI-Key")
	.build();

Response response = client.newCall(request).execute();

Request Covid-19 Data Using PHP Curl

Use the below php code to fetch the Covid 19 India state & DIstrict Wise Data. Use your X-RapidAPI-Key in the curl request.

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
	CURLOPT_URL =&amp;gt; "https://corona-virus-world-and-india-data.p.rapidapi.com/api_india",
	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 =array(
		"x-rapidapi-host: corona-virus-world-and-india-data.p.rapidapi.com",
		"x-rapidapi-key: YOUR_X-RapidAPI-Key"
	),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
	echo "cURL Error #:" . $err;
} else {
	echo $response;
}

?>

Request Covid-19 Data Using NodeJs HTTP

Use the below nodejs code to fetch the Covid 19 India state & DIstrict Wise Data. Use your X-RapidAPI-Key in the curl request.
var http = require("https");

var options = {
	"method": "GET",
	"hostname": "corona-virus-world-and-india-data.p.rapidapi.com",
	"port": null,
	"path": "/api_india",
	"headers": {
		"x-rapidapi-host": "corona-virus-world-and-india-data.p.rapidapi.com",
		"x-rapidapi-key": "YOUR_X-RapidAPI-Key"
	}
};

var req = http.request(options, function (res) {
	var chunks = [];

	res.on("data", function (chunk) {
		chunks.push(chunk);
	});

	res.on("end", function () {
		var body = Buffer.concat(chunks);
		console.log(body.toString());
	});
});

req.end();

Request Covid-19 Data Using Shell cURL

Use the below Shell code to fetch the Covid 19 India state & DIstrict Wise Data. Use your X-RapidAPI-Key in the curl request.
curl --request GET \
	--url https://corona-virus-world-and-india-data.p.rapidapi.com/api_india \
	--header 'x-rapidapi-host: corona-virus-world-and-india-data.p.rapidapi.com' \
	--header 'x-rapidapi-key: YOUR_X-RapidAPI-Key'

Output

We got the response in the json look like below json packet. We expanded only Maharashtra State.
{3 items
"key_values":NULL
"total_values":{11 items
"active":"33561"
"confirmed":"49400"
"deaths":"1693"
"deltaconfirmed":"2966"
"deltadeaths":"127"
"deltarecovered":"1297"
"lastupdatedtime":"05/05/2020 23:40:45"
"recovered":"14142"
"state":"Total"
"statecode":"TT"
"statenotes":""
}
"state_wise":{37 items
	"Maharashtra":{12 items
		"active":"12089"
		"confirmed":"15525"
		"deaths":"617"
		"deltaconfirmed":"984"
		"deltadeaths":"34"
		"deltarecovered":"354"
		"lastupdatedtime":"05/05/2020 22:52:46"
		"recovered":"2819"
		"state":"Maharashtra"
		"statecode":"MH"
		"statenotes":"[04-May]&lt;br&gt; - Total numbers are updated to the final figure reported for 04th May. &lt;br&gt; - This means an extra 796 cases are added to this date apart from the +771 as "today's cases" by the state.&lt;br&gt; - Reason mentioned in state bulletin : "Figures as per ICMR list are updated for districts and MC other than Mumbai"&lt;br&gt;"
		"district":{35 items
		"Other States":{...}6 items
		"Ahmednagar":{6 items
			"notes":""
			"active":27
			"confirmed":53
			"deceased":2
			"recovered":24
			"delta":{3 items
				"confirmed":11
				"deceased":0
				"recovered":0
			}
	}
		"Akola":{...}6 items
		"Amravati":{...}6 items
		"Aurangabad":{...}6 items
		"Bhandara":{...}6 items
		"Beed":{...}6 items
		"Buldhana":{...}6 items
		"Chandrapur":{...}6 items
		"Dhule":{...}6 items
		"Gondia":{...}6 items
		"Hingoli":{...}6 items
		"Jalgaon":{...}6 items
		"Jalna":{...}6 items
		"Kolhapur":{...}6 items
		"Latur":{...}6 items
		"Mumbai":{...}6 items
		"Nagpur":{...}6 items
		"Nanded":{...}6 items
		"Nandurbar":{...}6 items
		"Nashik":{...}6 items
		"Osmanabad":{...}6 items
		"Palghar":{...}6 items
		"Parbhani":{...}6 items
		"Pune":{...}6 items
		"Raigad":{...}6 items
		"Ratnagiri":{...}6 items
		"Sangli":{...}6 items
		"Satara":{...}6 items
		"Sindhudurg":{...}6 items
		"Solapur":{...}6 items
		"Thane":{...}6 items
		"Washim":{...}6 items
		"Yavatmal":{...}6 items
		"Unknown":{...}6 items
		}
	}
	"Gujarat":{...}12 items
	"Delhi":{...}12 items
	"Tamil Nadu":{...}12 items
	"Rajasthan":{...}12 items
	"Madhya Pradesh":{...}12 items
	"Uttar Pradesh":{...}12 items
	"Andhra Pradesh":{...}12 items
	"Punjab":{...}12 items
	"West Bengal":{...}12 items
	"Telangana":{...}12 items
	"Jammu and Kashmir":{...}12 items
	"Karnataka":{...}12 items
	"Haryana":{...}12 items
	"Bihar":{...}12 items
	"Kerala":{...}12 items
	"Odisha":{...}12 items
	"Jharkhand":{...}12 items
	"Chandigarh":{...}12 items
	"Uttarakhand":{...}12 items
	"Chhattisgarh":{...}12 items
	"Assam":{...}12 items
	"Ladakh":{...}12 items
	"Himachal Pradesh":{...}12 items
	"Tripura":{...}12 items
	"Andaman and Nicobar Islands":{...}12 items
	"Meghalaya":{...}12 items
	"Puducherry":{...}12 items
	"Goa":{...}12 items
	"Manipur":{...}12 items
	"Mizoram":{...}12 items
	"Arunachal Pradesh":{...}12 items
	"Dadra and Nagar Haveli":{...}12 items
	"Nagaland":{...}11 items
	"Daman and Diu":{...}11 items
	"Lakshadweep":{...}11 items
	"Sikkim":{...}11 items
	}
}
564FansLike

Recent Posts

How to Install & Setup the Java Development Kit (JDK)

If you do not have the newest JDK already put in in your pc, comply with the steps under. You have to have the JDK put in to run applications. To see which version of...

How to Setup Kotlin Plugin in Android Studio Tutorial

Kotlin is a programming language launched by JetBrains, the official designer of essentially the most intelligent Java IDE, named Intellij IDEA. One nice information of shifting to Kotlin is, you...

How to Parse Json in Android Application

JSON stands for JavaScript Object Notation.It is an independent data trade format and is the perfect various for XML. This chapter explains the way to parse the JSON file and...

Related Articles

How to Install & Setup the Java Development Kit (JDK)

If you do not have the newest JDK already put in in your pc, comply with the steps under. You have to have the JDK put in to run applications. To see which version of...

How to Setup Kotlin Plugin in Android Studio Tutorial

Kotlin is a programming language launched by JetBrains, the official designer of essentially the most intelligent Java IDE, named Intellij IDEA. One nice information of shifting to Kotlin is, you...

How to Parse Json in Android Application

JSON stands for JavaScript Object Notation.It is an independent data trade format and is the perfect various for XML. This chapter explains the way to parse the JSON file and...