curl --request POST \
--url https://api.eka.care/admin/datasets/v1/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"medication_id": "DRUG1001",
"name": "Dolo 650",
"strength": "650mg",
"generic_name": "Paracetamol",
"form_name": "Tablet",
"manufacturer": "Micro Labs Ltd"
},
{
"medication_id": "DRUG1002",
"name": "Augmentin 625 Duo",
"generic_list": [
"Amoxicillin",
"Clavulanic Acid"
],
"form_name": "Tablet"
}
]
'import requests
url = "https://api.eka.care/admin/datasets/v1/"
payload = [
{
"medication_id": "DRUG1001",
"name": "Dolo 650",
"strength": "650mg",
"generic_name": "Paracetamol",
"form_name": "Tablet",
"manufacturer": "Micro Labs Ltd"
},
{
"medication_id": "DRUG1002",
"name": "Augmentin 625 Duo",
"generic_list": ["Amoxicillin", "Clavulanic Acid"],
"form_name": "Tablet"
}
]
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
medication_id: 'DRUG1001',
name: 'Dolo 650',
strength: '650mg',
generic_name: 'Paracetamol',
form_name: 'Tablet',
manufacturer: 'Micro Labs Ltd'
},
{
medication_id: 'DRUG1002',
name: 'Augmentin 625 Duo',
generic_list: ['Amoxicillin', 'Clavulanic Acid'],
form_name: 'Tablet'
}
])
};
fetch('https://api.eka.care/admin/datasets/v1/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.eka.care/admin/datasets/v1/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"medication_id\": \"DRUG1001\",\n \"name\": \"Dolo 650\",\n \"strength\": \"650mg\",\n \"generic_name\": \"Paracetamol\",\n \"form_name\": \"Tablet\",\n \"manufacturer\": \"Micro Labs Ltd\"\n },\n {\n \"medication_id\": \"DRUG1002\",\n \"name\": \"Augmentin 625 Duo\",\n \"generic_list\": [\n \"Amoxicillin\",\n \"Clavulanic Acid\"\n ],\n \"form_name\": \"Tablet\"\n }\n]")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.eka.care/admin/datasets/v1/");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("[\n {\n \"medication_id\": \"DRUG1001\",\n \"name\": \"Dolo 650\",\n \"strength\": \"650mg\",\n \"generic_name\": \"Paracetamol\",\n \"form_name\": \"Tablet\",\n \"manufacturer\": \"Micro Labs Ltd\"\n },\n {\n \"medication_id\": \"DRUG1002\",\n \"name\": \"Augmentin 625 Duo\",\n \"generic_list\": [\n \"Amoxicillin\",\n \"Clavulanic Acid\"\n ],\n \"form_name\": \"Tablet\"\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/admin/datasets/v1/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"medication_id\": \"DRUG1001\",\n \"name\": \"Dolo 650\",\n \"strength\": \"650mg\",\n \"generic_name\": \"Paracetamol\",\n \"form_name\": \"Tablet\",\n \"manufacturer\": \"Micro Labs Ltd\"\n },\n {\n \"medication_id\": \"DRUG1002\",\n \"name\": \"Augmentin 625 Duo\",\n \"generic_list\": [\n \"Amoxicillin\",\n \"Clavulanic Acid\"\n ],\n \"form_name\": \"Tablet\"\n }\n]"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "2 medication upserted",
"data": {
"upserted": 2,
"inserted": 1,
"updated": 1,
"reactivated": 0,
"deactivated": 0,
"dry_run": false
}
}Create or update records
Writes records to the catalog. Send either a JSON list of records (Content-Type: application/json) or a CSV file (multipart/form-data, field file, headers as in the CSV template).
Writes are all-or-nothing: if any record or row fails validation, nothing in the request is written and errors lists every problem.
Modes
upsert(default): records in the request are inserted, or merged into the existing record with the same id. Records not in the request are left alone.reconcile: the request is treated as your complete catalog. Records in it are inserted or updated, and every active record not in it is deactivated (never hard-deleted, so it can be restored by sending it again). If a reconcile would deactivate more than half of a non-empty catalog, it is rejected with ashrink_guarderror unless you passconfirm_shrink=true. An empty list or a CSV with no data rows is always rejected in this mode.
Use dry_run=true to validate and get the counts without writing anything.
For type=lab_panel, every id in member_result_ids must already be stored as a lab_result in your workspace, so write results first. A panel needs at least one member and an id can appear once. A member that is not a stored result is rejected with the message <id> is not a result in this catalog.
overwrite=true (CSV only) hard-deletes the whole catalog and replaces it with the file, in one transaction. It cannot be combined with mode=reconcile; prefer reconcile, which can be undone.
curl --request POST \
--url https://api.eka.care/admin/datasets/v1/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
{
"medication_id": "DRUG1001",
"name": "Dolo 650",
"strength": "650mg",
"generic_name": "Paracetamol",
"form_name": "Tablet",
"manufacturer": "Micro Labs Ltd"
},
{
"medication_id": "DRUG1002",
"name": "Augmentin 625 Duo",
"generic_list": [
"Amoxicillin",
"Clavulanic Acid"
],
"form_name": "Tablet"
}
]
'import requests
url = "https://api.eka.care/admin/datasets/v1/"
payload = [
{
"medication_id": "DRUG1001",
"name": "Dolo 650",
"strength": "650mg",
"generic_name": "Paracetamol",
"form_name": "Tablet",
"manufacturer": "Micro Labs Ltd"
},
{
"medication_id": "DRUG1002",
"name": "Augmentin 625 Duo",
"generic_list": ["Amoxicillin", "Clavulanic Acid"],
"form_name": "Tablet"
}
]
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
medication_id: 'DRUG1001',
name: 'Dolo 650',
strength: '650mg',
generic_name: 'Paracetamol',
form_name: 'Tablet',
manufacturer: 'Micro Labs Ltd'
},
{
medication_id: 'DRUG1002',
name: 'Augmentin 625 Duo',
generic_list: ['Amoxicillin', 'Clavulanic Acid'],
form_name: 'Tablet'
}
])
};
fetch('https://api.eka.care/admin/datasets/v1/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.eka.care/admin/datasets/v1/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("[\n {\n \"medication_id\": \"DRUG1001\",\n \"name\": \"Dolo 650\",\n \"strength\": \"650mg\",\n \"generic_name\": \"Paracetamol\",\n \"form_name\": \"Tablet\",\n \"manufacturer\": \"Micro Labs Ltd\"\n },\n {\n \"medication_id\": \"DRUG1002\",\n \"name\": \"Augmentin 625 Duo\",\n \"generic_list\": [\n \"Amoxicillin\",\n \"Clavulanic Acid\"\n ],\n \"form_name\": \"Tablet\"\n }\n]")
.asString();using RestSharp;
var options = new RestClientOptions("https://api.eka.care/admin/datasets/v1/");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("[\n {\n \"medication_id\": \"DRUG1001\",\n \"name\": \"Dolo 650\",\n \"strength\": \"650mg\",\n \"generic_name\": \"Paracetamol\",\n \"form_name\": \"Tablet\",\n \"manufacturer\": \"Micro Labs Ltd\"\n },\n {\n \"medication_id\": \"DRUG1002\",\n \"name\": \"Augmentin 625 Duo\",\n \"generic_list\": [\n \"Amoxicillin\",\n \"Clavulanic Acid\"\n ],\n \"form_name\": \"Tablet\"\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/admin/datasets/v1/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"medication_id\": \"DRUG1001\",\n \"name\": \"Dolo 650\",\n \"strength\": \"650mg\",\n \"generic_name\": \"Paracetamol\",\n \"form_name\": \"Tablet\",\n \"manufacturer\": \"Micro Labs Ltd\"\n },\n {\n \"medication_id\": \"DRUG1002\",\n \"name\": \"Augmentin 625 Duo\",\n \"generic_list\": [\n \"Amoxicillin\",\n \"Clavulanic Acid\"\n ],\n \"form_name\": \"Tablet\"\n }\n]"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "2 medication upserted",
"data": {
"upserted": 2,
"inserted": 1,
"updated": 1,
"reactivated": 0,
"deactivated": 0,
"dry_run": false
}
}Query Parameters
Body
1- Medication
- LabInvestigation
- LabResult
- LabPanel
- Symptom
- Diagnosis
Optional. Eka's own id for this item, taken from Eka's reference list, so Eka products (for example EMR calculators) recognise it. Not checked against Eka's records; an id you send is stored as given. Re-uploading a CSV without this column keeps existing values; a blank cell in the column clears it. In a JSON update, leaving ekaid out or sending it empty keeps the current value.
64Dosage form. Matched case-insensitively against the accepted drug forms; a match links the drug to Eka's form, and any other value is stored as text without that link.
64Was this page helpful?

