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));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();using RestSharp;
var options = new RestClientOptions("https://api.eka.care/mr/api/v1/cases");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-Pt-Id", "<x-pt-id>");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\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}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
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"
}Medical Records
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));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();using RestSharp;
var options = new RestClientOptions("https://api.eka.care/mr/api/v1/cases");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-Pt-Id", "<x-pt-id>");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\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}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
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?

