cowinapi / developer.cowin

This group is created to facilitate technical and integration discussions related to cowin platform. API related contents can be obtained at API setu portal https://apisetu.gov.in/public/marketplace/api/cowin
115 stars 30 forks source link

"Invalid Slot Id" error while calling the - /v2/appointment/schedule #372

Open AdityaPimpalkar opened 3 years ago

AdityaPimpalkar commented 3 years ago

Is anyone else getting this issue? I keep getting this same error every single time the program finds an open slot

OTP generation and validation-

https://cdn-api.co-vin.in/api/v2/auth/generateMobileOTP
https://cdn-api.co-vin.in/api/v2/auth/validateMobileOtp

Fetching my slot sessions -

https://cdn-api.co-vin.in/api/v2/appointment/sessions/public/findByDistrict

Booking appointment -

const requestOptions = {
    method: "POST",
    headers: {
      Authorization: "Bearer " + token,
      Accept: "application/json",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      dose: 1,
      session_id: txnId, 
      slot: "AFTERNOON",
      beneficiaries: ["25252525252"],
    }),
    redirect: "follow",
  };

fetch("https://cdn-api.co-vin.in/api/v2/appointment/schedule", requestOptions)

I am doubtful about the value I should be passing in "session_id" parameter, should it be txnId or some other value?

Any help with would be appreciated!!

karsumit94 commented 3 years ago

This is an internal Api and not meant to be used for automation

AdityaPimpalkar commented 3 years ago

@karsumit94 Thanks for replying! I am not sure I got what you said, could you elaborate?

If we are not supposed to use the /appointment/schedule API then hen how are we supposed to book the slot?

amartya-s commented 3 years ago

@karsumit94 Thanks for replying! I am not sure I got what you said, could you elaborate?

If we are not supposed to use the /appointment/schedule API then hen how are we supposed to book the slot?

Again, these are internal APIs and are not intended to be used by public to book slot.

amartya-s commented 3 years ago

By the way, let;s say even you are allowed to use these APIs, you are doing it all wrong. Please refer : https://apisetu.gov.in/public/marketplace/api/cowin/cowin-protected-v2#/

srisankethu commented 3 years ago

@AdityaPimpalkar @amartya-s @karsumit94 The Protected APIs can be used for production. Read the first paragraph in this page and complete ASP registration for production access.

As for your question, just check the response Vaccination Appointment APIs GET methods for example, /v2/appointment/sessions/findByPin. The response of this method contains session_id. Need to use this session_id.