curl --request POST \
--url https://api.eka.care/dr/v1/patient \
--header 'Content-Type: application/json' \
--header 'auth: <auth>' \
--data '
{
"dob": "1987-01-06",
"first_name": "Test",
"gender": "M",
"designation": "Mr.",
"partner_patient_id": "6742984",
"middle_name": "",
"last_name": "Patient",
"mobile": "+919999999999",
"address": {
"city": "Bangalore",
"pincode": 560049
}
}
'import requests
url = "https://api.eka.care/dr/v1/patient"
payload = {
"dob": "1987-01-06",
"first_name": "Test",
"gender": "M",
"designation": "Mr.",
"partner_patient_id": "6742984",
"middle_name": "",
"last_name": "Patient",
"mobile": "+919999999999",
"address": {
"city": "Bangalore",
"pincode": 560049
}
}
headers = {
"auth": "<auth>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {auth: '<auth>', 'Content-Type': 'application/json'},
body: JSON.stringify({
dob: '1987-01-06',
first_name: 'Test',
gender: 'M',
designation: 'Mr.',
partner_patient_id: '6742984',
middle_name: '',
last_name: 'Patient',
mobile: '+919999999999',
address: {city: 'Bangalore', pincode: 560049}
})
};
fetch('https://api.eka.care/dr/v1/patient', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.eka.care/dr/v1/patient",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'dob' => '1987-01-06',
'first_name' => 'Test',
'gender' => 'M',
'designation' => 'Mr.',
'partner_patient_id' => '6742984',
'middle_name' => '',
'last_name' => 'Patient',
'mobile' => '+919999999999',
'address' => [
'city' => 'Bangalore',
'pincode' => 560049
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"auth: <auth>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.eka.care/dr/v1/patient"
payload := strings.NewReader("{\n \"dob\": \"1987-01-06\",\n \"first_name\": \"Test\",\n \"gender\": \"M\",\n \"designation\": \"Mr.\",\n \"partner_patient_id\": \"6742984\",\n \"middle_name\": \"\",\n \"last_name\": \"Patient\",\n \"mobile\": \"+919999999999\",\n \"address\": {\n \"city\": \"Bangalore\",\n \"pincode\": 560049\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("auth", "<auth>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.eka.care/dr/v1/patient")
.header("auth", "<auth>")
.header("Content-Type", "application/json")
.body("{\n \"dob\": \"1987-01-06\",\n \"first_name\": \"Test\",\n \"gender\": \"M\",\n \"designation\": \"Mr.\",\n \"partner_patient_id\": \"6742984\",\n \"middle_name\": \"\",\n \"last_name\": \"Patient\",\n \"mobile\": \"+919999999999\",\n \"address\": {\n \"city\": \"Bangalore\",\n \"pincode\": 560049\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eka.care/dr/v1/patient")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["auth"] = '<auth>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"dob\": \"1987-01-06\",\n \"first_name\": \"Test\",\n \"gender\": \"M\",\n \"designation\": \"Mr.\",\n \"partner_patient_id\": \"6742984\",\n \"middle_name\": \"\",\n \"last_name\": \"Patient\",\n \"mobile\": \"+919999999999\",\n \"address\": {\n \"city\": \"Bangalore\",\n \"pincode\": 560049\n }\n}"
response = http.request(request)
puts response.read_body{
"patient_id": "123456789"
}{
"error": {
"code": "NOT_ALLOWED",
"message": "You are not allowed to add resource"
}
}{
"error": {
"code": "PATIENT_ALREADY_EXISTS",
"message": "Patient already exists with the same partner_patient_id: abc"
}
}{
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error"
}
}Add Patient to Directory
This functionality enables the addition of new patient records to a business’ directory. Users can provide necessary details such as personal information, contact details, and medical history to create a new patient profile.
In case the patient is already registered with Eka care, then passing the patient eka id will be enough
curl --request POST \
--url https://api.eka.care/dr/v1/patient \
--header 'Content-Type: application/json' \
--header 'auth: <auth>' \
--data '
{
"dob": "1987-01-06",
"first_name": "Test",
"gender": "M",
"designation": "Mr.",
"partner_patient_id": "6742984",
"middle_name": "",
"last_name": "Patient",
"mobile": "+919999999999",
"address": {
"city": "Bangalore",
"pincode": 560049
}
}
'import requests
url = "https://api.eka.care/dr/v1/patient"
payload = {
"dob": "1987-01-06",
"first_name": "Test",
"gender": "M",
"designation": "Mr.",
"partner_patient_id": "6742984",
"middle_name": "",
"last_name": "Patient",
"mobile": "+919999999999",
"address": {
"city": "Bangalore",
"pincode": 560049
}
}
headers = {
"auth": "<auth>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {auth: '<auth>', 'Content-Type': 'application/json'},
body: JSON.stringify({
dob: '1987-01-06',
first_name: 'Test',
gender: 'M',
designation: 'Mr.',
partner_patient_id: '6742984',
middle_name: '',
last_name: 'Patient',
mobile: '+919999999999',
address: {city: 'Bangalore', pincode: 560049}
})
};
fetch('https://api.eka.care/dr/v1/patient', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.eka.care/dr/v1/patient",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'dob' => '1987-01-06',
'first_name' => 'Test',
'gender' => 'M',
'designation' => 'Mr.',
'partner_patient_id' => '6742984',
'middle_name' => '',
'last_name' => 'Patient',
'mobile' => '+919999999999',
'address' => [
'city' => 'Bangalore',
'pincode' => 560049
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"auth: <auth>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.eka.care/dr/v1/patient"
payload := strings.NewReader("{\n \"dob\": \"1987-01-06\",\n \"first_name\": \"Test\",\n \"gender\": \"M\",\n \"designation\": \"Mr.\",\n \"partner_patient_id\": \"6742984\",\n \"middle_name\": \"\",\n \"last_name\": \"Patient\",\n \"mobile\": \"+919999999999\",\n \"address\": {\n \"city\": \"Bangalore\",\n \"pincode\": 560049\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("auth", "<auth>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.eka.care/dr/v1/patient")
.header("auth", "<auth>")
.header("Content-Type", "application/json")
.body("{\n \"dob\": \"1987-01-06\",\n \"first_name\": \"Test\",\n \"gender\": \"M\",\n \"designation\": \"Mr.\",\n \"partner_patient_id\": \"6742984\",\n \"middle_name\": \"\",\n \"last_name\": \"Patient\",\n \"mobile\": \"+919999999999\",\n \"address\": {\n \"city\": \"Bangalore\",\n \"pincode\": 560049\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eka.care/dr/v1/patient")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["auth"] = '<auth>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"dob\": \"1987-01-06\",\n \"first_name\": \"Test\",\n \"gender\": \"M\",\n \"designation\": \"Mr.\",\n \"partner_patient_id\": \"6742984\",\n \"middle_name\": \"\",\n \"last_name\": \"Patient\",\n \"mobile\": \"+919999999999\",\n \"address\": {\n \"city\": \"Bangalore\",\n \"pincode\": 560049\n }\n}"
response = http.request(request)
puts response.read_body{
"patient_id": "123456789"
}{
"error": {
"code": "NOT_ALLOWED",
"message": "You are not allowed to add resource"
}
}{
"error": {
"code": "PATIENT_ALREADY_EXISTS",
"message": "Patient already exists with the same partner_patient_id: abc"
}
}{
"error": {
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error"
}
}Headers
The auth token of business_id. It is used to authenticate the business. The token can be fetched from the auth api.
Body
Request body for adding a patient to the directory
- DOB
- AGE
Date of birth of the patient (YYYY-MM-DD)
"1987-01-06"
First name of the patient
"Test"
Gender of the patient (e.g., 'M' for male, 'F' for female, 'O' for others)
M, F, O "M"
Title or designation of the patient
Mr., Ms., Mrs., Miss., Kumar., Shri., Smt., Dr., Master., Baby., Mohd., B/O "Mr."
Identifier for the partner’s patient.
"6742984"
Middle name of the patient (if any)
""
Last name of the patient
"Patient"
Mobile number of the patient, including country code
"+919999999999"
Address details of the patient
Show child attributes
Show child attributes
Response
OK
"123456789"
Was this page helpful?

