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

Getting Unauthenticated access! for /v2/appointment/centers/findByLatLong #442

Open HimanshuGupta26 opened 3 years ago

HimanshuGupta26 commented 3 years ago

I am getting getting Unauthenticated access! with Status code 401 for /v2/appointment/centers/findByLatLong. I am sending the header key as "x-api-key" and the value that is given on swagger documentation

big89 commented 3 years ago

You need to pass Authorization Bearer token in header which you will get in confirm OTP response.

curl -X GET "https://cdndemo-api.co-vin.in/api/v2/appointment/centers/findByLatLong?lat=28.7&long=77.1" -H "accept: application/json" -H "Accept-Language: en_US" -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxx"

Thanks, Logicmaker

HimanshuGupta26 commented 3 years ago

Thank you for your support. Yes, it worked. But I have another query. Like on UAT v2/appointment/sessions/calendarByPin API is needing Authentication header but checked same for Production, it didn't need it

big89 commented 3 years ago

It seems like public API call without any user specific authorization to get such data.

Also, as production APIs having registered access with API key, may not required Authorization header.

Thanks, Logicmaker

HimanshuGupta26 commented 3 years ago

But I tried Production API as it is. Hit this as a Get URL, https://cdn-api.co-vin.in/api/v2/appointment/sessions/public/calendarByPin?pincode=147301&date=15-06-2021, Data will be fetched

HimanshuGupta26 commented 3 years ago

And for /v2/appointment/sessions/calendarByPin and /v2/appointment/sessions/calendarByDistrict API, response is always as below: "centers": [] Can you tell me some pin codes on which I can get Data

HimanshuGupta26 commented 3 years ago

And for /api/v2/registration/beneficiary/new API, I am getting Status Code 403, ERROR: The request could not be satisfied

big89 commented 3 years ago

Status Code 403 means server refuses your request somehow.

Make sure request is like -

curl -X POST "https://cdn-api.co-vin.in/api/v2/registration/beneficiary/new" -H "accept: application/json" -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxx" -H "Content-Type: application/json" -d "{\"name\":\"Apparao\",\"birth_year\":\"1980\",\"gender_id\":1,\"photo_id_type\":1,\"photo_id_number\":\"9999\",\"comorbidity_ind\":\"Y\",\"consent_version\":\"1\"}"

Thanks, Logicmaker

HimanshuGupta26 commented 3 years ago

Status Code 403 means server refuses your request somehow.

Make sure request is like -

curl -X POST "https://cdn-api.co-vin.in/api/v2/registration/beneficiary/new" -H "accept: application/json" -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxx" -H "Content-Type: application/json" -d "{"name":"Apparao","birth_year":"1980","gender_id":1,"photo_id_type":1,"photo_id_number":"9999","comorbidity_ind":"Y","consent_version":"1"}"

Thanks, Logicmaker

I am talking about UAT API. Please check what's the issue with that.

HimanshuGupta26 commented 3 years ago

And for /v2/appointment/sessions/calendarByPin and /v2/appointment/sessions/calendarByDistrict API, response is always as below: "centers": [] Can you tell me some pin codes on which I can get Data

Please suggest what to do as UAT testing cannot be proceeded

HimanshuGupta26 commented 3 years ago

It seems like public API call without any user specific authorization to get such data.

Also, as production APIs having registered access with API key, may not required Authorization header.

Thanks, Logicmaker

Please suggest in this case also. As UAT and Production flow should be same.

siddhesh1770 commented 3 years ago

API is restricted to 25 calls per hour now so please code accordingly !!!

HimanshuGupta26 commented 3 years ago

And for /v2/appointment/sessions/calendarByPin and /v2/appointment/sessions/calendarByDistrict API, response is always as below: "centers": [] Can you tell me some pin codes on which I can get Data

Please suggest what to do as UAT testing cannot proceed

Please update on it. It is blocker for me

HimanshuGupta26 commented 3 years ago

And for /v2/appointment/sessions/calendarByPin and /v2/appointment/sessions/calendarByDistrict API, response is always as below: "centers": [] Can you tell me some pin codes on which I can get Data

Please suggest what to do as UAT testing cannot proceed

Please update on it. It is blocker for me

Please update on it.

HimanshuGupta26 commented 3 years ago

And for /v2/appointment/sessions/calendarByPin and /v2/appointment/sessions/calendarByDistrict API, response is always as below: "centers": [] Can you tell me some pin codes on which I can get Data

Please suggest what to do as UAT testing cannot proceed

Please update on it. It is blocker for me

Please update on it.

Please update on it. It's really Important

webloper commented 3 years ago

Thank you for your support. Yes, it worked. But I have another query. Like on UAT v2/appointment/sessions/calendarByPin API is needing Authentication header but checked same for Production, it didn't need it

@HimanshuGupta26 Can you share working curl request for the same

HimanshuGupta26 commented 3 years ago

Sir, currently I am stuck due to no data on Staging for v2/appointment/sessions/public/calendarByPin and v2/appointment/sessions/public/calendarByDistrict