Skip to main content
PATCH
/
mr
/
api
/
v1
/
cases
/
{id}
Update Case
curl --request PATCH \
  --url https://api.eka.care/mr/api/v1/cases/{id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-Pt-Id: <x-pt-id>' \
  --data '
{
  "display_name": "Leg Injury",
  "hi_type": "OPConsultation",
  "type": "OP",
  "occurred_at": 1678886400,
  "partner_meta": {
    "facility_id": "GH",
    "uhid": "UHID_1234"
  }
}
'
import requests

url = "https://api.eka.care/mr/api/v1/cases/{id}"

payload = {
"display_name": "Leg Injury",
"hi_type": "OPConsultation",
"type": "OP",
"occurred_at": 1678886400,
"partner_meta": {
"facility_id": "GH",
"uhid": "UHID_1234"
}
}
headers = {
"X-Pt-Id": "<x-pt-id>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {
'X-Pt-Id': '<x-pt-id>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
display_name: 'Leg Injury',
hi_type: 'OPConsultation',
type: 'OP',
occurred_at: 1678886400,
partner_meta: {facility_id: 'GH', uhid: 'UHID_1234'}
})
};

fetch('https://api.eka.care/mr/api/v1/cases/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'display_name' => 'Leg Injury',
'hi_type' => 'OPConsultation',
'type' => 'OP',
'occurred_at' => 1678886400,
'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/{id}"

payload := strings.NewReader("{\n \"display_name\": \"Leg Injury\",\n \"hi_type\": \"OPConsultation\",\n \"type\": \"OP\",\n \"occurred_at\": 1678886400,\n \"partner_meta\": {\n \"facility_id\": \"GH\",\n \"uhid\": \"UHID_1234\"\n }\n}")

req, _ := http.NewRequest("PATCH", 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.patch("https://api.eka.care/mr/api/v1/cases/{id}")
.header("X-Pt-Id", "<x-pt-id>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"display_name\": \"Leg Injury\",\n \"hi_type\": \"OPConsultation\",\n \"type\": \"OP\",\n \"occurred_at\": 1678886400,\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/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["X-Pt-Id"] = '<x-pt-id>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"display_name\": \"Leg Injury\",\n \"hi_type\": \"OPConsultation\",\n \"type\": \"OP\",\n \"occurred_at\": 1678886400,\n \"partner_meta\": {\n \"facility_id\": \"GH\",\n \"uhid\": \"UHID_1234\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "error": "Missing required field: type",
  "code": "BAD_REQUEST"
}
{
"error": "Invalid or expired token",
"code": "UNAUTHORIZED"
}
{
"error": "Case not found for the given ID",
"code": "CASE_NOT_FOUND"
}
{
"error": "Something went wrong while processing the request",
"code": "INTERNAL_SERVER_ERROR"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

X-Pt-Id
string
required

Patient ID

Path Parameters

id
string
required

Unique case ID

Body

application/json
display_name
string

Human-readable name for the case

Example:

"Leg Injury"

hi_type
enum<string>

Type of case

Available options:
OPConsultation,
Prescription,
DischargeSummary,
DiagnosticReport,
ImmunizationRecord,
HealthDocumentRecord,
WellnessRecord
Example:

"OPConsultation"

type
string

Type of the case

Example:

"OP"

occurred_at
integer<unixtime>

Timestamp when the event occurred (Unix timestamp)

Example:

1678886400

partner_meta
object

metadata attached to the case.

Example:
{ "facility_id": "GH", "uhid": "UHID_1234" }

Response

Case updated successfully (no content)