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

how I can I use the protected access key of cowin #472

Open krunalkokane opened 3 years ago

krunalkokane commented 3 years ago

for trying with postman or from programming language how I can I use the protected access key please let us know if there is documentation on how to consume the api from postman or programming language

big89 commented 3 years ago

@krunalkokane Co-Win API portal already given Swagger documentation which can generate cURL request for each API.

For refrence you can check below PHP script for Generate OTP Protected API with given Sandbox API Key -

`<?php $ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://cdndemo-api.co-vin.in/api/v2/auth/generateOTP'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, '{"mobile":"9876543210"}');

$headers = array(); $headers[] = 'Accept: application/json'; $headers[] = 'X-Api-Key: 3sjOr2rmM52GzhpMHjDEE1kpQeRxwFDr4YcBEimi'; $headers[] = 'Content-Type: application/json'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch);

echo $result; ?>`

Similarly check for other APIs on API portal as no any other reference provided except that.

Thanks, Logicmaker