https://github.com/tuhinpal/cowin
A NodeJS wrapper of Cowin Public API
https://github.com/tuhinpal/cowin
covaccine covid19-india covishield cowin cowin-nodejs india-covid
Last synced: 18 days ago
JSON representation
A NodeJS wrapper of Cowin Public API
- Host: GitHub
- URL: https://github.com/tuhinpal/cowin
- Owner: tuhinpal
- License: apache-2.0
- Created: 2021-05-13T06:40:19.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-05-13T06:41:16.000Z (almost 4 years ago)
- Last Synced: 2025-04-14T15:09:09.151Z (18 days ago)
- Topics: covaccine, covid19-india, covishield, cowin, cowin-nodejs, india-covid
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/cowin
- Size: 7.81 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cowin
## A NodeJS wrapper of [Cowin Public API](https://apisetu.gov.in/public/marketplace/api/cowin/cowin-public-v2#/). We can win Covid 🤝
### Installation:
```
npm install cowin
```### Available methods:
- **getState** - _Get all states in India_
- **getListofDistricts** - _Get get all the districts of state_
- **findByPin** - _Get planned vaccination sessions on a specific date in a given pin_
- **findByDistrict** - _Get planned vaccination sessions on a specific date in a given district_
- **calendarByPin** - _Get planned vaccination sessions for 7 days from a specific date in a given pin_,
- **calendarByDistrict** - _Get planned vaccination sessions for 7 days from a specific date in a given district_Referred to [Cowin API Docs](https://apisetu.gov.in/public/marketplace/api/cowin/cowin-public-v2#/) for more details.
### Usage:
- Import required modules
```
const {
getStates,
getListofDistricts,
findByPin,
findByDistrict,
calendarByPin,
calendarByDistrict
} = require('cowin')
```- Write asynchronous function
```
async function fireitup() { /* asynchronous */const allstates = await getStates()
console.log(allstates)const alldistricts = await getListofDistricts(36) /* { state_id } */
console.log(alldistricts)const calenderbypin = await calendarByPin(731204, '13-05-2021') /* { pincode, date } */
console.log(calenderbypin)const calenderbydistrict = await calendarByDistrict(713, '13-05-2021') /* district_id, date */
console.log(calenderbydistrict)const findbypin = await findByPin(731204, '13-05-2021') /* { pincode, date } */
console.log(findbypin)const findbydistrict = await findByDistrict(713, '13-05-2021') /* district_id, date */
console.log(findbydistrict)}
fireitup()
```- Response will looks like
```
{
status: true,
result: [/* Results */]
}
```- Exception handling
```
{
status: false,
message: "Sorry that's an error"
}
```### Limitation:
APIs are subject to a rate limit of 100 API calls per 5 minutes per IP
## Crafted with care by [Tuhin](https://github.com/cachecleanerjeet) 💗