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 405 `Method Not Allowed` from Co-WIN Vaccinator APIs (West Bengal Health) #426

Open Rafikul-babu1 opened 3 years ago

Rafikul-babu1 commented 3 years ago

Url : https://cdn-api.co-vin.in/api/v2/vaccinator/beneficiaries/new West Bengal Health.

big89 commented 3 years ago

@Rafikul-babu1 You can refer below PHP code for this API call.

`<?php $ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'https://cdndemo-api.co-vin.in/api/v2/vaccinator/beneficiaries/new'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"name\":\"Apparao\",\"birth_year\":\"1980\",\"gender_id\":1,\"mobile_number\":\"9876543210\",\"photo_id_type\":1,\"photo_id_number\":\"9999\",\"consent_version\":\"1\"}");

$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; ?>`

You will need API Key to access this APIs.

Thanks, Logicmaker