pallupz / covid-vaccine-booking

This tool can be used to automate booking slots on Co-WIN Platform.
MIT License
598 stars 533 forks source link

Kindly add booking by center ID directly #216

Open rshnGhost opened 3 years ago

rshnGhost commented 3 years ago

(https://cdn-api.co-vin.in/api/v2/appointment/sessions/public/calendarByCenter?center_id={centerID}&date={date}) using above url provid a booking option for particular "center ID" directly @pallupz

cowinID1

pallupz commented 3 years ago

I wanted to but most people wont know the center ID, right? I hadn't seen an API to list centers or get their IDs

rshnGhost commented 3 years ago

@pallupz while user selects option pincode, prompt for option to book by center id, so now there will given list of centers in that picodes along is center name.

I am asking for this option because center in one pincodes is located with 3-5kilometers, during lockdown its hard to travel. kindly look in to it. thanku

pallupz commented 3 years ago

that is a good idea. Problem is where to get this part:

list of centers in that pincodes

rshnGhost commented 3 years ago

@pallupz

when we get on below link, which is used for find by pincode and date

https://cdn-api.co-vin.in/api/v2/appointment/sessions/public/findByPin?pincode=110011&date=29-05-2021

we get response as

{
  "sessions": [
    {
      "center_id": **624711**,
      "name": "Naval Medical Center INS India",
      "address": "Dara Shukoh Road New Delhi",
      "state_name": "Delhi",
      "district_name": "New Delhi",
      "block_name": "Not Applicable",
      "pincode": 110011,
      "from": "09:00:00",
      "to": "17:00:00",
      "lat": 28,
      "long": 77,
      "fee_type": "Free",
      "session_id": "d0ed0de1-ae90-4616-85ca-57b7def5e76a",
      "date": "29-05-2021",
      "available_capacity_dose1": 0,
      "available_capacity_dose2": 0,
      "available_capacity": 0,
      "fee": "0",
      "min_age_limit": 45,
      "vaccine": "COVISHIELD",
      "slots": [
        "09:00AM-11:00AM",
        "11:00AM-01:00PM",
        "01:00PM-03:00PM",
        "03:00PM-05:00PM"
      ]
    }
  ]
}

so filter by

centerId = sessions[center_id]

rshnGhost commented 3 years ago

@pallupz

same with get request on findByDistrict

https://cdn-api.co-vin.in/api/v2/appointment/sessions/public/findByDistrict?district_id=512&date=31-03-2021

we get response as..

{
  "sessions": [
    {
      "center_id": 605499,
      "name": "PHC NANGI BALHEER",
      "address": "",
      "state_name": "Rajasthan",
      "district_name": "Alwar",
      "block_name": "Shahjahanpur",
      "pincode": 301703,
      "from": "09:00:00",
      "to": "17:00:00",
      "lat": 27.56093,
      "long": 76.62502,
      "fee_type": "Free",
      "session_id": "c67953da-d9ce-4e56-9c97-4b2f96a49e79",
      "date": "31-03-2021",
      "available_capacity_dose1": 0,
      "available_capacity_dose2": 0,
      "available_capacity": 100,
      "fee": "0",
      "min_age_limit": 45,
      "vaccine": "COVISHIELD",
      "slots": [
        "09:00AM-11:00AM",
        "11:00AM-01:00PM",
        "01:00PM-03:00PM",
        "03:00PM-05:00PM"
      ]
    }
  ]
}

so filter by

centerId = sessions[center_id]