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

CORS issue while using swagger in API Setu #197

Open varshaneya opened 3 years ago

varshaneya commented 3 years ago

Hello, Encountered CORS issue while using the swagger provided in https://apisetu.gov.in/public/marketplace/api/cowin#/

image

Can this be sorted out? Thank you

bkrajendra commented 3 years ago

make sure you are using Content-Type: application/json header and proper method (post, get).

varshaneya commented 3 years ago

Where is the option to set the content type in the swagger provided in the website: image

bkrajendra commented 3 years ago

@varshaneya, it's not about API. Its general practice to ad required headers while using RESTrequests. Depends on which language/platform you are using.

Also, what I have realized from your error, is that you are somehow adding a language header that is not being accepted by API end pint.

image

Make sure you are sending an authorization header with GET request, as findByPin is a protected API. If you can give more details about your implementation, it will be easy to understand.

bkrajendra commented 3 years ago

If you are trying from https://apisetu.gov.in/ then you need an auth token.