Create Case
curl --request POST \
--url https://api.eka.care/mr/api/v1/cases \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Pt-Id: <x-pt-id>' \
--data '
{
"id": "CASE_ID",
"display_name": "Leg Injury",
"occurred_at": 1678886400,
"hi_type": "OPConsultation",
"type": "OP",
"partner_meta": {
"facility_id": "GH",
"uhid": "UHID_1234"
}
}
'import requests
url = "https://api.eka.care/mr/api/v1/cases"
payload = {
"id": "CASE_ID",
"display_name": "Leg Injury",
"occurred_at": 1678886400,
"hi_type": "OPConsultation",
"type": "OP",
"partner_meta": {
"facility_id": "GH",
"uhid": "UHID_1234"
}
}
headers = {
"X-Pt-Id": "<x-pt-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Pt-Id': '<x-pt-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
id: 'CASE_ID',
display_name: 'Leg Injury',
occurred_at: 1678886400,
hi_type: 'OPConsultation',
type: 'OP',
partner_meta: {facility_id: 'GH', uhid: 'UHID_1234'}
})
};
fetch('https://api.eka.care/mr/api/v1/cases', 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/mr/api/v1/cases",
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([
'id' => 'CASE_ID',
'display_name' => 'Leg Injury',
'occurred_at' => 1678886400,
'hi_type' => 'OPConsultation',
'type' => 'OP',
'partner_meta' => [
'facility_id' => 'GH',
'uhid' => 'UHID_1234'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Pt-Id: <x-pt-id>"
],
]);
$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/mr/api/v1/cases"
payload := strings.NewReader("{\n \"id\": \"CASE_ID\",\n \"display_name\": \"Leg Injury\",\n \"occurred_at\": 1678886400,\n \"hi_type\": \"OPConsultation\",\n \"type\": \"OP\",\n \"partner_meta\": {\n \"facility_id\": \"GH\",\n \"uhid\": \"UHID_1234\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Pt-Id", "<x-pt-id>")
req.Header.Add("Authorization", "Bearer <token>")
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/mr/api/v1/cases")
.header("X-Pt-Id", "<x-pt-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"CASE_ID\",\n \"display_name\": \"Leg Injury\",\n \"occurred_at\": 1678886400,\n \"hi_type\": \"OPConsultation\",\n \"type\": \"OP\",\n \"partner_meta\": {\n \"facility_id\": \"GH\",\n \"uhid\": \"UHID_1234\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eka.care/mr/api/v1/cases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Pt-Id"] = '<x-pt-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"CASE_ID\",\n \"display_name\": \"Leg Injury\",\n \"occurred_at\": 1678886400,\n \"hi_type\": \"OPConsultation\",\n \"type\": \"OP\",\n \"partner_meta\": {\n \"facility_id\": \"GH\",\n \"uhid\": \"UHID_1234\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "case_12345"
}{
"error": "Missing required field: type",
"code": "BAD_REQUEST"
}{
"error": "Unauthorized access. Invalid token.",
"code": "UNAUTHORIZED"
}{
"error": "Case Already Exist"
}{
"error": "An unexpected error occurred while creating the case.",
"code": "INTERNAL_SERVER_ERROR"
}Cases
Create Case
This endpoint creates a new medical case.
POST
/
mr
/
api
/
v1
/
cases
Create Case
curl --request POST \
--url https://api.eka.care/mr/api/v1/cases \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'X-Pt-Id: <x-pt-id>' \
--data '
{
"id": "CASE_ID",
"display_name": "Leg Injury",
"occurred_at": 1678886400,
"hi_type": "OPConsultation",
"type": "OP",
"partner_meta": {
"facility_id": "GH",
"uhid": "UHID_1234"
}
}
'import requests
url = "https://api.eka.care/mr/api/v1/cases"
payload = {
"id": "CASE_ID",
"display_name": "Leg Injury",
"occurred_at": 1678886400,
"hi_type": "OPConsultation",
"type": "OP",
"partner_meta": {
"facility_id": "GH",
"uhid": "UHID_1234"
}
}
headers = {
"X-Pt-Id": "<x-pt-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Pt-Id': '<x-pt-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
id: 'CASE_ID',
display_name: 'Leg Injury',
occurred_at: 1678886400,
hi_type: 'OPConsultation',
type: 'OP',
partner_meta: {facility_id: 'GH', uhid: 'UHID_1234'}
})
};
fetch('https://api.eka.care/mr/api/v1/cases', 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/mr/api/v1/cases",
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([
'id' => 'CASE_ID',
'display_name' => 'Leg Injury',
'occurred_at' => 1678886400,
'hi_type' => 'OPConsultation',
'type' => 'OP',
'partner_meta' => [
'facility_id' => 'GH',
'uhid' => 'UHID_1234'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"X-Pt-Id: <x-pt-id>"
],
]);
$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/mr/api/v1/cases"
payload := strings.NewReader("{\n \"id\": \"CASE_ID\",\n \"display_name\": \"Leg Injury\",\n \"occurred_at\": 1678886400,\n \"hi_type\": \"OPConsultation\",\n \"type\": \"OP\",\n \"partner_meta\": {\n \"facility_id\": \"GH\",\n \"uhid\": \"UHID_1234\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Pt-Id", "<x-pt-id>")
req.Header.Add("Authorization", "Bearer <token>")
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/mr/api/v1/cases")
.header("X-Pt-Id", "<x-pt-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"CASE_ID\",\n \"display_name\": \"Leg Injury\",\n \"occurred_at\": 1678886400,\n \"hi_type\": \"OPConsultation\",\n \"type\": \"OP\",\n \"partner_meta\": {\n \"facility_id\": \"GH\",\n \"uhid\": \"UHID_1234\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eka.care/mr/api/v1/cases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Pt-Id"] = '<x-pt-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"CASE_ID\",\n \"display_name\": \"Leg Injury\",\n \"occurred_at\": 1678886400,\n \"hi_type\": \"OPConsultation\",\n \"type\": \"OP\",\n \"partner_meta\": {\n \"facility_id\": \"GH\",\n \"uhid\": \"UHID_1234\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "case_12345"
}{
"error": "Missing required field: type",
"code": "BAD_REQUEST"
}{
"error": "Unauthorized access. Invalid token.",
"code": "UNAUTHORIZED"
}{
"error": "Case Already Exist"
}{
"error": "An unexpected error occurred while creating the case.",
"code": "INTERNAL_SERVER_ERROR"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Patient ID
Body
application/json
Unique identifier for the case.
Example:
"CASE_ID"
Human-readable name for the case
Example:
"Leg Injury"
Timestamp when the event occurred (Unix timestamp)
Example:
1678886400
Type of case
Available options:
OPConsultation, Prescription, DischargeSummary, DiagnosticReport, ImmunizationRecord, HealthDocumentRecord, WellnessRecord Example:
"OPConsultation"
Type of the case
Example:
"OP"
metadata attached to the case.
Example:
{ "facility_id": "GH", "uhid": "UHID_1234" }
Response
Case created successfully
Unique identifier for the newly created case
Example:
"case_12345"
Was this page helpful?
⌘I

