Scenario: [1:26]
TC-MED-001 | REQ-MED-001 GET /MedicationRequest/{id} returns 200 and resourceType = MedicationRequest
ms: 9999
>>
Background:
15
* url baseUrl
0
03:40:12.354 baseUrl: https://hapi.fhir.org/baseR4
03:40:12.354 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
5019
03:40:12.356 request:
1 > GET https://hapi.fhir.org/baseR4/MedicationRequest?subject%3Amissing=false&_count=1
1 > Host: hapi.fhir.org
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
1 > Accept-Encoding: gzip,deflate
03:40:17.374 response time in milliseconds: 5017
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Thu, 16 Apr 2026 03:40:17 GMT
1 < Content-Type: application/fhir+json;charset=utf-8
1 < Transfer-Encoding: chunked
1 < Connection: keep-alive
1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
1 < X-Request-ID: pkatqjnG7LRZas5m
1 < Last-Modified: Thu, 16 Apr 2026 03:40:17 GMT
{
"resourceType": "Bundle",
"id": "4d262d36-5c94-49a2-8c3b-1cb3caa31086",
"meta": {
"lastUpdated": "2026-04-16T03:40:17.318+00:00"
},
"type": "searchset",
"link": [ {
"relation": "self",
"url": "https://hapi.fhir.org/baseR4/MedicationRequest?_count=1&subject%3Amissing=false"
}, {
"relation": "next",
"url": "https://hapi.fhir.org/baseR4?_getpages=4d262d36-5c94-49a2-8c3b-1cb3caa31086&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset"
} ],
"entry": [ {
"fullUrl": "https://hapi.fhir.org/baseR4/MedicationRequest/131289270",
"resource": {
"resourceType": "MedicationRequest",
"id": "131289270",
"meta": {
"versionId": "1",
"lastUpdated": "2026-02-26T18:49:38.875+00:00",
"source": "#pcqQcDegw1DzifFo"
},
"contained": [ {
"resourceType": "Practitioner",
"id": "drsmith",
"name": [ {
"family": "Smith",
"given": [ "John" ]
} ]
} ],
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [ {
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "860975",
"display": "Amoxicillin 500mg Capsule"
} ],
"text": "Amoxicillin 500mg Capsule"
},
"subject": {
"reference": "Patient/testmartin",
"display": "Martin Spangenberg"
},
"authoredOn": "2026-02-26",
"requester": {
"reference": "#drsmith",
"display": "Dr. John Smith"
},
"dosageInstruction": [ {
"sequence": 1,
"text": "Take 1 capsule by mouth three times a day for 7 days",
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"route": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/route-codes",
"code": "PO",
"display": "Oral"
} ]
},
"doseAndRate": [ {
"doseQuantity": {
"value": 1,
"unit": "capsule"
}
} ]
} ]
},
"search": {
"mode": "match"
}
} ]
}
19
Then status 200
0
20
* def hasEntry = response.entry != null && response.entry.length > 0
0
21
* match hasEntry == true
0
22
* def medicationId = response.entry[0].resource.id
0
23
* match response.entry[0].resource.resourceType == 'MedicationRequest'
0
24
* karate.log('Resolved medicationId: ' + medicationId)
0
03:40:17.375 Resolved medicationId: 131289270
27
Given path 'MedicationRequest', medicationId
0
28
When method GET
4976
03:40:17.376 request:
2 > GET https://hapi.fhir.org/baseR4/MedicationRequest/131289270
2 > Host: hapi.fhir.org
2 > Connection: Keep-Alive
2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
2 > Accept-Encoding: gzip,deflate
03:40:22.351 response time in milliseconds: 4974
2 < 200
2 < Server: nginx/1.24.0 (Ubuntu)
2 < Date: Thu, 16 Apr 2026 03:40:22 GMT
2 < Content-Type: application/fhir+json;charset=utf-8
2 < Transfer-Encoding: chunked
2 < Connection: keep-alive
2 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
2 < ETag: W/"1"
2 < X-Request-ID: iHnRN8U6q7s1ObhP
2 < Content-Location: https://hapi.fhir.org/baseR4/MedicationRequest/131289270/_history/1
2 < Last-Modified: Thu, 26 Feb 2026 18:49:38 GMT
{
"resourceType": "MedicationRequest",
"id": "131289270",
"meta": {
"versionId": "1",
"lastUpdated": "2026-02-26T18:49:38.875+00:00",
"source": "#pcqQcDegw1DzifFo"
},
"contained": [ {
"resourceType": "Practitioner",
"id": "drsmith",
"name": [ {
"family": "Smith",
"given": [ "John" ]
} ]
} ],
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [ {
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "860975",
"display": "Amoxicillin 500mg Capsule"
} ],
"text": "Amoxicillin 500mg Capsule"
},
"subject": {
"reference": "Patient/testmartin",
"display": "Martin Spangenberg"
},
"authoredOn": "2026-02-26",
"requester": {
"reference": "#drsmith",
"display": "Dr. John Smith"
},
"dosageInstruction": [ {
"sequence": 1,
"text": "Take 1 capsule by mouth three times a day for 7 days",
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"route": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/route-codes",
"code": "PO",
"display": "Oral"
} ]
},
"doseAndRate": [ {
"doseQuantity": {
"value": 1,
"unit": "capsule"
}
} ]
} ]
}
29
Then status 200
0
30
And assert responseTime < 10000
0
31
And match responseHeaders['Content-Type'][0] contains 'application/fhir+json'
0
32
And match responseHeaders['ETag'][0] == '#present'
0
33
And match response.resourceType == 'MedicationRequest'
0
34
* karate.write(response, 'responses/medication/medication-read.json')
2
03:40:22.354 write to file: target/responses/medication/medication-read.json
Scenario: [2:36]
TC-MED-002 | REQ-MED-002 status is a valid MedicationRequest status value
ms: 9996
>>
Background:
15
* url baseUrl
0
03:40:13.354 baseUrl: https://hapi.fhir.org/baseR4
03:40:13.354 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
5007
03:40:13.356 request:
1 > GET https://hapi.fhir.org/baseR4/MedicationRequest?subject%3Amissing=false&_count=1
1 > Host: hapi.fhir.org
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
1 > Accept-Encoding: gzip,deflate
03:40:18.361 response time in milliseconds: 5005
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Thu, 16 Apr 2026 03:40:18 GMT
1 < Content-Type: application/fhir+json;charset=utf-8
1 < Transfer-Encoding: chunked
1 < Connection: keep-alive
1 < X-Cache: HIT from https://hapi.fhir.org/baseR4
1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
1 < X-Request-ID: aMIXIVQQtHCVu8Ei
1 < Last-Modified: Thu, 16 Apr 2026 03:40:17 GMT
{
"resourceType": "Bundle",
"id": "4d262d36-5c94-49a2-8c3b-1cb3caa31086",
"meta": {
"lastUpdated": "2026-04-16T03:40:17.318+00:00"
},
"type": "searchset",
"link": [ {
"relation": "self",
"url": "https://hapi.fhir.org/baseR4/MedicationRequest?_count=1&subject%3Amissing=false"
}, {
"relation": "next",
"url": "https://hapi.fhir.org/baseR4?_getpages=4d262d36-5c94-49a2-8c3b-1cb3caa31086&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset"
} ],
"entry": [ {
"fullUrl": "https://hapi.fhir.org/baseR4/MedicationRequest/131289270",
"resource": {
"resourceType": "MedicationRequest",
"id": "131289270",
"meta": {
"versionId": "1",
"lastUpdated": "2026-02-26T18:49:38.875+00:00",
"source": "#pcqQcDegw1DzifFo"
},
"contained": [ {
"resourceType": "Practitioner",
"id": "drsmith",
"name": [ {
"family": "Smith",
"given": [ "John" ]
} ]
} ],
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [ {
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "860975",
"display": "Amoxicillin 500mg Capsule"
} ],
"text": "Amoxicillin 500mg Capsule"
},
"subject": {
"reference": "Patient/testmartin",
"display": "Martin Spangenberg"
},
"authoredOn": "2026-02-26",
"requester": {
"reference": "#drsmith",
"display": "Dr. John Smith"
},
"dosageInstruction": [ {
"sequence": 1,
"text": "Take 1 capsule by mouth three times a day for 7 days",
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"route": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/route-codes",
"code": "PO",
"display": "Oral"
} ]
},
"doseAndRate": [ {
"doseQuantity": {
"value": 1,
"unit": "capsule"
}
} ]
} ]
},
"search": {
"mode": "match"
}
} ]
}
19
Then status 200
0
20
* def hasEntry = response.entry != null && response.entry.length > 0
0
21
* match hasEntry == true
0
22
* def medicationId = response.entry[0].resource.id
0
23
* match response.entry[0].resource.resourceType == 'MedicationRequest'
0
24
* karate.log('Resolved medicationId: ' + medicationId)
1
03:40:18.363 Resolved medicationId: 131289270
37
Given path 'MedicationRequest', medicationId
0
38
When method GET
4986
03:40:18.364 request:
2 > GET https://hapi.fhir.org/baseR4/MedicationRequest/131289270
2 > Host: hapi.fhir.org
2 > Connection: Keep-Alive
2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
2 > Accept-Encoding: gzip,deflate
03:40:23.349 response time in milliseconds: 4985
2 < 200
2 < Server: nginx/1.24.0 (Ubuntu)
2 < Date: Thu, 16 Apr 2026 03:40:23 GMT
2 < Content-Type: application/fhir+json;charset=utf-8
2 < Transfer-Encoding: chunked
2 < Connection: keep-alive
2 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
2 < ETag: W/"1"
2 < X-Request-ID: 4BuZNYkr7XLryKzy
2 < Content-Location: https://hapi.fhir.org/baseR4/MedicationRequest/131289270/_history/1
2 < Last-Modified: Thu, 26 Feb 2026 18:49:38 GMT
{
"resourceType": "MedicationRequest",
"id": "131289270",
"meta": {
"versionId": "1",
"lastUpdated": "2026-02-26T18:49:38.875+00:00",
"source": "#pcqQcDegw1DzifFo"
},
"contained": [ {
"resourceType": "Practitioner",
"id": "drsmith",
"name": [ {
"family": "Smith",
"given": [ "John" ]
} ]
} ],
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [ {
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "860975",
"display": "Amoxicillin 500mg Capsule"
} ],
"text": "Amoxicillin 500mg Capsule"
},
"subject": {
"reference": "Patient/testmartin",
"display": "Martin Spangenberg"
},
"authoredOn": "2026-02-26",
"requester": {
"reference": "#drsmith",
"display": "Dr. John Smith"
},
"dosageInstruction": [ {
"sequence": 1,
"text": "Take 1 capsule by mouth three times a day for 7 days",
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"route": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/route-codes",
"code": "PO",
"display": "Oral"
} ]
},
"doseAndRate": [ {
"doseQuantity": {
"value": 1,
"unit": "capsule"
}
} ]
} ]
}
39
Then status 200
0
40
And match response.status == '#regex (active|on-hold|cancelled|completed|entered-in-error|stopped|draft|unknown)'
1
41
* karate.log('status: ' + response.status)
0
03:40:23.351 status: active
Scenario: [3:43]
TC-MED-003 | REQ-MED-003 intent is a valid MedicationRequest intent value
ms: 9980
>>
Background:
15
* url baseUrl
0
03:40:14.370 baseUrl: https://hapi.fhir.org/baseR4
03:40:14.370 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
4993
03:40:14.371 request:
1 > GET https://hapi.fhir.org/baseR4/MedicationRequest?subject%3Amissing=false&_count=1
1 > Host: hapi.fhir.org
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
1 > Accept-Encoding: gzip,deflate
03:40:19.363 response time in milliseconds: 4991
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Thu, 16 Apr 2026 03:40:19 GMT
1 < Content-Type: application/fhir+json;charset=utf-8
1 < Transfer-Encoding: chunked
1 < Connection: keep-alive
1 < X-Cache: HIT from https://hapi.fhir.org/baseR4
1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
1 < X-Request-ID: h2GLzBctfqlPmmSL
1 < Last-Modified: Thu, 16 Apr 2026 03:40:17 GMT
{
"resourceType": "Bundle",
"id": "4d262d36-5c94-49a2-8c3b-1cb3caa31086",
"meta": {
"lastUpdated": "2026-04-16T03:40:17.318+00:00"
},
"type": "searchset",
"link": [ {
"relation": "self",
"url": "https://hapi.fhir.org/baseR4/MedicationRequest?_count=1&subject%3Amissing=false"
}, {
"relation": "next",
"url": "https://hapi.fhir.org/baseR4?_getpages=4d262d36-5c94-49a2-8c3b-1cb3caa31086&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset"
} ],
"entry": [ {
"fullUrl": "https://hapi.fhir.org/baseR4/MedicationRequest/131289270",
"resource": {
"resourceType": "MedicationRequest",
"id": "131289270",
"meta": {
"versionId": "1",
"lastUpdated": "2026-02-26T18:49:38.875+00:00",
"source": "#pcqQcDegw1DzifFo"
},
"contained": [ {
"resourceType": "Practitioner",
"id": "drsmith",
"name": [ {
"family": "Smith",
"given": [ "John" ]
} ]
} ],
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [ {
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "860975",
"display": "Amoxicillin 500mg Capsule"
} ],
"text": "Amoxicillin 500mg Capsule"
},
"subject": {
"reference": "Patient/testmartin",
"display": "Martin Spangenberg"
},
"authoredOn": "2026-02-26",
"requester": {
"reference": "#drsmith",
"display": "Dr. John Smith"
},
"dosageInstruction": [ {
"sequence": 1,
"text": "Take 1 capsule by mouth three times a day for 7 days",
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"route": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/route-codes",
"code": "PO",
"display": "Oral"
} ]
},
"doseAndRate": [ {
"doseQuantity": {
"value": 1,
"unit": "capsule"
}
} ]
} ]
},
"search": {
"mode": "match"
}
} ]
}
19
Then status 200
0
20
* def hasEntry = response.entry != null && response.entry.length > 0
0
21
* match hasEntry == true
0
22
* def medicationId = response.entry[0].resource.id
0
23
* match response.entry[0].resource.resourceType == 'MedicationRequest'
0
24
* karate.log('Resolved medicationId: ' + medicationId)
0
03:40:19.364 Resolved medicationId: 131289270
44
Given path 'MedicationRequest', medicationId
0
45
When method GET
4985
03:40:19.365 request:
2 > GET https://hapi.fhir.org/baseR4/MedicationRequest/131289270
2 > Host: hapi.fhir.org
2 > Connection: Keep-Alive
2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
2 > Accept-Encoding: gzip,deflate
03:40:24.350 response time in milliseconds: 4984
2 < 200
2 < Server: nginx/1.24.0 (Ubuntu)
2 < Date: Thu, 16 Apr 2026 03:40:24 GMT
2 < Content-Type: application/fhir+json;charset=utf-8
2 < Transfer-Encoding: chunked
2 < Connection: keep-alive
2 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
2 < ETag: W/"1"
2 < X-Request-ID: BeuFrQVM3nWYTVcX
2 < Content-Location: https://hapi.fhir.org/baseR4/MedicationRequest/131289270/_history/1
2 < Last-Modified: Thu, 26 Feb 2026 18:49:38 GMT
{
"resourceType": "MedicationRequest",
"id": "131289270",
"meta": {
"versionId": "1",
"lastUpdated": "2026-02-26T18:49:38.875+00:00",
"source": "#pcqQcDegw1DzifFo"
},
"contained": [ {
"resourceType": "Practitioner",
"id": "drsmith",
"name": [ {
"family": "Smith",
"given": [ "John" ]
} ]
} ],
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [ {
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "860975",
"display": "Amoxicillin 500mg Capsule"
} ],
"text": "Amoxicillin 500mg Capsule"
},
"subject": {
"reference": "Patient/testmartin",
"display": "Martin Spangenberg"
},
"authoredOn": "2026-02-26",
"requester": {
"reference": "#drsmith",
"display": "Dr. John Smith"
},
"dosageInstruction": [ {
"sequence": 1,
"text": "Take 1 capsule by mouth three times a day for 7 days",
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"route": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/route-codes",
"code": "PO",
"display": "Oral"
} ]
},
"doseAndRate": [ {
"doseQuantity": {
"value": 1,
"unit": "capsule"
}
} ]
} ]
}
46
Then status 200
0
47
And match response.intent == '#regex (proposal|plan|order|original-order|reflex-order|filler-order|instance-order|option)'
0
48
* karate.log('intent: ' + response.intent)
0
03:40:24.351 intent: order
Scenario: [4:50]
TC-MED-004 | REQ-MED-004 subject references Patient
ms: 9982
>>
Background:
15
* url baseUrl
0
03:40:15.368 baseUrl: https://hapi.fhir.org/baseR4
03:40:15.368 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
4995
03:40:15.369 request:
1 > GET https://hapi.fhir.org/baseR4/MedicationRequest?subject%3Amissing=false&_count=1
1 > Host: hapi.fhir.org
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
1 > Accept-Encoding: gzip,deflate
03:40:20.363 response time in milliseconds: 4994
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Thu, 16 Apr 2026 03:40:20 GMT
1 < Content-Type: application/fhir+json;charset=utf-8
1 < Transfer-Encoding: chunked
1 < Connection: keep-alive
1 < X-Cache: HIT from https://hapi.fhir.org/baseR4
1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
1 < X-Request-ID: fCCRfBHLdcSfPjiS
1 < Last-Modified: Thu, 16 Apr 2026 03:40:17 GMT
{
"resourceType": "Bundle",
"id": "4d262d36-5c94-49a2-8c3b-1cb3caa31086",
"meta": {
"lastUpdated": "2026-04-16T03:40:17.318+00:00"
},
"type": "searchset",
"link": [ {
"relation": "self",
"url": "https://hapi.fhir.org/baseR4/MedicationRequest?_count=1&subject%3Amissing=false"
}, {
"relation": "next",
"url": "https://hapi.fhir.org/baseR4?_getpages=4d262d36-5c94-49a2-8c3b-1cb3caa31086&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset"
} ],
"entry": [ {
"fullUrl": "https://hapi.fhir.org/baseR4/MedicationRequest/131289270",
"resource": {
"resourceType": "MedicationRequest",
"id": "131289270",
"meta": {
"versionId": "1",
"lastUpdated": "2026-02-26T18:49:38.875+00:00",
"source": "#pcqQcDegw1DzifFo"
},
"contained": [ {
"resourceType": "Practitioner",
"id": "drsmith",
"name": [ {
"family": "Smith",
"given": [ "John" ]
} ]
} ],
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [ {
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "860975",
"display": "Amoxicillin 500mg Capsule"
} ],
"text": "Amoxicillin 500mg Capsule"
},
"subject": {
"reference": "Patient/testmartin",
"display": "Martin Spangenberg"
},
"authoredOn": "2026-02-26",
"requester": {
"reference": "#drsmith",
"display": "Dr. John Smith"
},
"dosageInstruction": [ {
"sequence": 1,
"text": "Take 1 capsule by mouth three times a day for 7 days",
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"route": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/route-codes",
"code": "PO",
"display": "Oral"
} ]
},
"doseAndRate": [ {
"doseQuantity": {
"value": 1,
"unit": "capsule"
}
} ]
} ]
},
"search": {
"mode": "match"
}
} ]
}
19
Then status 200
0
20
* def hasEntry = response.entry != null && response.entry.length > 0
0
21
* match hasEntry == true
0
22
* def medicationId = response.entry[0].resource.id
0
23
* match response.entry[0].resource.resourceType == 'MedicationRequest'
0
24
* karate.log('Resolved medicationId: ' + medicationId)
1
03:40:20.365 Resolved medicationId: 131289270
51
Given path 'MedicationRequest', medicationId
0
52
When method GET
4984
03:40:20.366 request:
2 > GET https://hapi.fhir.org/baseR4/MedicationRequest/131289270
2 > Host: hapi.fhir.org
2 > Connection: Keep-Alive
2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
2 > Accept-Encoding: gzip,deflate
03:40:25.349 response time in milliseconds: 4982
2 < 200
2 < Server: nginx/1.24.0 (Ubuntu)
2 < Date: Thu, 16 Apr 2026 03:40:25 GMT
2 < Content-Type: application/fhir+json;charset=utf-8
2 < Transfer-Encoding: chunked
2 < Connection: keep-alive
2 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
2 < ETag: W/"1"
2 < X-Request-ID: pgmcyOnJmiq7EBUp
2 < Content-Location: https://hapi.fhir.org/baseR4/MedicationRequest/131289270/_history/1
2 < Last-Modified: Thu, 26 Feb 2026 18:49:38 GMT
{
"resourceType": "MedicationRequest",
"id": "131289270",
"meta": {
"versionId": "1",
"lastUpdated": "2026-02-26T18:49:38.875+00:00",
"source": "#pcqQcDegw1DzifFo"
},
"contained": [ {
"resourceType": "Practitioner",
"id": "drsmith",
"name": [ {
"family": "Smith",
"given": [ "John" ]
} ]
} ],
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [ {
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "860975",
"display": "Amoxicillin 500mg Capsule"
} ],
"text": "Amoxicillin 500mg Capsule"
},
"subject": {
"reference": "Patient/testmartin",
"display": "Martin Spangenberg"
},
"authoredOn": "2026-02-26",
"requester": {
"reference": "#drsmith",
"display": "Dr. John Smith"
},
"dosageInstruction": [ {
"sequence": 1,
"text": "Take 1 capsule by mouth three times a day for 7 days",
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"route": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/route-codes",
"code": "PO",
"display": "Oral"
} ]
},
"doseAndRate": [ {
"doseQuantity": {
"value": 1,
"unit": "capsule"
}
} ]
} ]
}
53
Then status 200
0
54
And match response.subject == '#present'
0
55
And match response.subject.reference == '#string'
0
56
And match response.subject.reference == '#regex .*Patient.*'
0
57
* karate.log('subject reference: ' + response.subject.reference)
1
03:40:25.350 subject reference: Patient/testmartin
Scenario: [5:59]
TC-MED-005 | REQ-MED-005 medicationCodeableConcept or medicationReference is present
ms: 9998
>>
Background:
15
* url baseUrl
0
03:40:21.353 baseUrl: https://hapi.fhir.org/baseR4
03:40:21.353 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
5007
03:40:21.355 request:
1 > GET https://hapi.fhir.org/baseR4/MedicationRequest?subject%3Amissing=false&_count=1
1 > Host: hapi.fhir.org
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
1 > Accept-Encoding: gzip,deflate
03:40:26.361 response time in milliseconds: 5005
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Thu, 16 Apr 2026 03:40:26 GMT
1 < Content-Type: application/fhir+json;charset=utf-8
1 < Transfer-Encoding: chunked
1 < Connection: keep-alive
1 < X-Cache: HIT from https://hapi.fhir.org/baseR4
1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
1 < X-Request-ID: SgtIYBtwV0OxcpuL
1 < Last-Modified: Thu, 16 Apr 2026 03:40:17 GMT
{
"resourceType": "Bundle",
"id": "4d262d36-5c94-49a2-8c3b-1cb3caa31086",
"meta": {
"lastUpdated": "2026-04-16T03:40:17.318+00:00"
},
"type": "searchset",
"link": [ {
"relation": "self",
"url": "https://hapi.fhir.org/baseR4/MedicationRequest?_count=1&subject%3Amissing=false"
}, {
"relation": "next",
"url": "https://hapi.fhir.org/baseR4?_getpages=4d262d36-5c94-49a2-8c3b-1cb3caa31086&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset"
} ],
"entry": [ {
"fullUrl": "https://hapi.fhir.org/baseR4/MedicationRequest/131289270",
"resource": {
"resourceType": "MedicationRequest",
"id": "131289270",
"meta": {
"versionId": "1",
"lastUpdated": "2026-02-26T18:49:38.875+00:00",
"source": "#pcqQcDegw1DzifFo"
},
"contained": [ {
"resourceType": "Practitioner",
"id": "drsmith",
"name": [ {
"family": "Smith",
"given": [ "John" ]
} ]
} ],
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [ {
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "860975",
"display": "Amoxicillin 500mg Capsule"
} ],
"text": "Amoxicillin 500mg Capsule"
},
"subject": {
"reference": "Patient/testmartin",
"display": "Martin Spangenberg"
},
"authoredOn": "2026-02-26",
"requester": {
"reference": "#drsmith",
"display": "Dr. John Smith"
},
"dosageInstruction": [ {
"sequence": 1,
"text": "Take 1 capsule by mouth three times a day for 7 days",
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"route": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/route-codes",
"code": "PO",
"display": "Oral"
} ]
},
"doseAndRate": [ {
"doseQuantity": {
"value": 1,
"unit": "capsule"
}
} ]
} ]
},
"search": {
"mode": "match"
}
} ]
}
19
Then status 200
0
20
* def hasEntry = response.entry != null && response.entry.length > 0
0
21
* match hasEntry == true
0
22
* def medicationId = response.entry[0].resource.id
0
23
* match response.entry[0].resource.resourceType == 'MedicationRequest'
0
24
* karate.log('Resolved medicationId: ' + medicationId)
0
03:40:26.362 Resolved medicationId: 131289270
60
Given path 'MedicationRequest', medicationId
0
61
When method GET
4988
03:40:26.363 request:
2 > GET https://hapi.fhir.org/baseR4/MedicationRequest/131289270
2 > Host: hapi.fhir.org
2 > Connection: Keep-Alive
2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
2 > Accept-Encoding: gzip,deflate
03:40:31.350 response time in milliseconds: 4986
2 < 200
2 < Server: nginx/1.24.0 (Ubuntu)
2 < Date: Thu, 16 Apr 2026 03:40:31 GMT
2 < Content-Type: application/fhir+json;charset=utf-8
2 < Transfer-Encoding: chunked
2 < Connection: keep-alive
2 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
2 < ETag: W/"1"
2 < X-Request-ID: Ns3kzbirKa4IqiC4
2 < Content-Location: https://hapi.fhir.org/baseR4/MedicationRequest/131289270/_history/1
2 < Last-Modified: Thu, 26 Feb 2026 18:49:38 GMT
{
"resourceType": "MedicationRequest",
"id": "131289270",
"meta": {
"versionId": "1",
"lastUpdated": "2026-02-26T18:49:38.875+00:00",
"source": "#pcqQcDegw1DzifFo"
},
"contained": [ {
"resourceType": "Practitioner",
"id": "drsmith",
"name": [ {
"family": "Smith",
"given": [ "John" ]
} ]
} ],
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [ {
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "860975",
"display": "Amoxicillin 500mg Capsule"
} ],
"text": "Amoxicillin 500mg Capsule"
},
"subject": {
"reference": "Patient/testmartin",
"display": "Martin Spangenberg"
},
"authoredOn": "2026-02-26",
"requester": {
"reference": "#drsmith",
"display": "Dr. John Smith"
},
"dosageInstruction": [ {
"sequence": 1,
"text": "Take 1 capsule by mouth three times a day for 7 days",
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"route": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/route-codes",
"code": "PO",
"display": "Oral"
} ]
},
"doseAndRate": [ {
"doseQuantity": {
"value": 1,
"unit": "capsule"
}
} ]
} ]
}
62
Then status 200
0
63
* def hasMedCC = response.medicationCodeableConcept != null
0
64
* def hasMedRef = response.medicationReference != null
0
65
* def hasMedication = hasMedCC || hasMedRef
0
66
* match hasMedication == true
0
67
* if (hasMedCC) karate.log('medication: medicationCodeableConcept present')
1
03:40:31.352 medication: medicationCodeableConcept present
68
* if (hasMedRef) karate.log('medication: medicationReference present')
0
Scenario: [6:70]
TC-MED-006 | REQ-MED-006 | REQ-GEN-002a meta.lastUpdated is present
ms: 9992
>>
Background:
15
* url baseUrl
0
03:40:22.357 baseUrl: https://hapi.fhir.org/baseR4
03:40:22.357 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
5005
03:40:22.359 request:
1 > GET https://hapi.fhir.org/baseR4/MedicationRequest?subject%3Amissing=false&_count=1
1 > Host: hapi.fhir.org
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
1 > Accept-Encoding: gzip,deflate
03:40:27.363 response time in milliseconds: 5003
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Thu, 16 Apr 2026 03:40:27 GMT
1 < Content-Type: application/fhir+json;charset=utf-8
1 < Transfer-Encoding: chunked
1 < Connection: keep-alive
1 < X-Cache: HIT from https://hapi.fhir.org/baseR4
1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
1 < X-Request-ID: ZeZQomCx8OAX90XX
1 < Last-Modified: Thu, 16 Apr 2026 03:40:17 GMT
{
"resourceType": "Bundle",
"id": "4d262d36-5c94-49a2-8c3b-1cb3caa31086",
"meta": {
"lastUpdated": "2026-04-16T03:40:17.318+00:00"
},
"type": "searchset",
"link": [ {
"relation": "self",
"url": "https://hapi.fhir.org/baseR4/MedicationRequest?_count=1&subject%3Amissing=false"
}, {
"relation": "next",
"url": "https://hapi.fhir.org/baseR4?_getpages=4d262d36-5c94-49a2-8c3b-1cb3caa31086&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset"
} ],
"entry": [ {
"fullUrl": "https://hapi.fhir.org/baseR4/MedicationRequest/131289270",
"resource": {
"resourceType": "MedicationRequest",
"id": "131289270",
"meta": {
"versionId": "1",
"lastUpdated": "2026-02-26T18:49:38.875+00:00",
"source": "#pcqQcDegw1DzifFo"
},
"contained": [ {
"resourceType": "Practitioner",
"id": "drsmith",
"name": [ {
"family": "Smith",
"given": [ "John" ]
} ]
} ],
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [ {
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "860975",
"display": "Amoxicillin 500mg Capsule"
} ],
"text": "Amoxicillin 500mg Capsule"
},
"subject": {
"reference": "Patient/testmartin",
"display": "Martin Spangenberg"
},
"authoredOn": "2026-02-26",
"requester": {
"reference": "#drsmith",
"display": "Dr. John Smith"
},
"dosageInstruction": [ {
"sequence": 1,
"text": "Take 1 capsule by mouth three times a day for 7 days",
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"route": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/route-codes",
"code": "PO",
"display": "Oral"
} ]
},
"doseAndRate": [ {
"doseQuantity": {
"value": 1,
"unit": "capsule"
}
} ]
} ]
},
"search": {
"mode": "match"
}
} ]
}
19
Then status 200
0
20
* def hasEntry = response.entry != null && response.entry.length > 0
0
21
* match hasEntry == true
0
22
* def medicationId = response.entry[0].resource.id
0
23
* match response.entry[0].resource.resourceType == 'MedicationRequest'
0
24
* karate.log('Resolved medicationId: ' + medicationId)
0
03:40:27.364 Resolved medicationId: 131289270
71
Given path 'MedicationRequest', medicationId
0
72
When method GET
4984
03:40:27.365 request:
2 > GET https://hapi.fhir.org/baseR4/MedicationRequest/131289270
2 > Host: hapi.fhir.org
2 > Connection: Keep-Alive
2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
2 > Accept-Encoding: gzip,deflate
03:40:32.348 response time in milliseconds: 4983
2 < 200
2 < Server: nginx/1.24.0 (Ubuntu)
2 < Date: Thu, 16 Apr 2026 03:40:32 GMT
2 < Content-Type: application/fhir+json;charset=utf-8
2 < Transfer-Encoding: chunked
2 < Connection: keep-alive
2 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
2 < ETag: W/"1"
2 < X-Request-ID: e6smQ5SG6hAPQJAP
2 < Content-Location: https://hapi.fhir.org/baseR4/MedicationRequest/131289270/_history/1
2 < Last-Modified: Thu, 26 Feb 2026 18:49:38 GMT
{
"resourceType": "MedicationRequest",
"id": "131289270",
"meta": {
"versionId": "1",
"lastUpdated": "2026-02-26T18:49:38.875+00:00",
"source": "#pcqQcDegw1DzifFo"
},
"contained": [ {
"resourceType": "Practitioner",
"id": "drsmith",
"name": [ {
"family": "Smith",
"given": [ "John" ]
} ]
} ],
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [ {
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "860975",
"display": "Amoxicillin 500mg Capsule"
} ],
"text": "Amoxicillin 500mg Capsule"
},
"subject": {
"reference": "Patient/testmartin",
"display": "Martin Spangenberg"
},
"authoredOn": "2026-02-26",
"requester": {
"reference": "#drsmith",
"display": "Dr. John Smith"
},
"dosageInstruction": [ {
"sequence": 1,
"text": "Take 1 capsule by mouth three times a day for 7 days",
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"route": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/route-codes",
"code": "PO",
"display": "Oral"
} ]
},
"doseAndRate": [ {
"doseQuantity": {
"value": 1,
"unit": "capsule"
}
} ]
} ]
}
73
Then status 200
0
74
And match response.meta.lastUpdated == '#present'
0
75
* karate.log('meta.lastUpdated: ' + response.meta.lastUpdated)
0
03:40:32.349 meta.lastUpdated: 2026-02-26T18:49:38.875+00:00
Scenario: [7:77]
TC-MED-007 | REQ-MED-007 | REQ-OO-001 non-existent ID returns 404 and OperationOutcome
ms: 10003
>>
Background:
15
* url baseUrl
0
03:40:23.353 baseUrl: https://hapi.fhir.org/baseR4
03:40:23.354 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
5008
03:40:23.355 request:
1 > GET https://hapi.fhir.org/baseR4/MedicationRequest?subject%3Amissing=false&_count=1
1 > Host: hapi.fhir.org
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
1 > Accept-Encoding: gzip,deflate
03:40:28.361 response time in milliseconds: 5006
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Thu, 16 Apr 2026 03:40:28 GMT
1 < Content-Type: application/fhir+json;charset=utf-8
1 < Transfer-Encoding: chunked
1 < Connection: keep-alive
1 < X-Cache: HIT from https://hapi.fhir.org/baseR4
1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
1 < X-Request-ID: kiok3MZo7YHoVsN2
1 < Last-Modified: Thu, 16 Apr 2026 03:40:17 GMT
{
"resourceType": "Bundle",
"id": "4d262d36-5c94-49a2-8c3b-1cb3caa31086",
"meta": {
"lastUpdated": "2026-04-16T03:40:17.318+00:00"
},
"type": "searchset",
"link": [ {
"relation": "self",
"url": "https://hapi.fhir.org/baseR4/MedicationRequest?_count=1&subject%3Amissing=false"
}, {
"relation": "next",
"url": "https://hapi.fhir.org/baseR4?_getpages=4d262d36-5c94-49a2-8c3b-1cb3caa31086&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset"
} ],
"entry": [ {
"fullUrl": "https://hapi.fhir.org/baseR4/MedicationRequest/131289270",
"resource": {
"resourceType": "MedicationRequest",
"id": "131289270",
"meta": {
"versionId": "1",
"lastUpdated": "2026-02-26T18:49:38.875+00:00",
"source": "#pcqQcDegw1DzifFo"
},
"contained": [ {
"resourceType": "Practitioner",
"id": "drsmith",
"name": [ {
"family": "Smith",
"given": [ "John" ]
} ]
} ],
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [ {
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "860975",
"display": "Amoxicillin 500mg Capsule"
} ],
"text": "Amoxicillin 500mg Capsule"
},
"subject": {
"reference": "Patient/testmartin",
"display": "Martin Spangenberg"
},
"authoredOn": "2026-02-26",
"requester": {
"reference": "#drsmith",
"display": "Dr. John Smith"
},
"dosageInstruction": [ {
"sequence": 1,
"text": "Take 1 capsule by mouth three times a day for 7 days",
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"route": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/route-codes",
"code": "PO",
"display": "Oral"
} ]
},
"doseAndRate": [ {
"doseQuantity": {
"value": 1,
"unit": "capsule"
}
} ]
} ]
},
"search": {
"mode": "match"
}
} ]
}
19
Then status 200
0
20
* def hasEntry = response.entry != null && response.entry.length > 0
0
21
* match hasEntry == true
0
22
* def medicationId = response.entry[0].resource.id
0
23
* match response.entry[0].resource.resourceType == 'MedicationRequest'
0
24
* karate.log('Resolved medicationId: ' + medicationId)
0
03:40:28.363 Resolved medicationId: 131289270
78
Given path 'MedicationRequest', 'INVALID-ID-99999'
0
79
When method GET
4992
03:40:28.364 request:
2 > GET https://hapi.fhir.org/baseR4/MedicationRequest/INVALID-ID-99999
2 > Host: hapi.fhir.org
2 > Connection: Keep-Alive
2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
2 > Accept-Encoding: gzip,deflate
03:40:33.354 response time in milliseconds: 4990
2 < 404
2 < Server: nginx/1.24.0 (Ubuntu)
2 < Date: Thu, 16 Apr 2026 03:40:33 GMT
2 < Content-Type: application/fhir+json;charset=utf-8
2 < Transfer-Encoding: chunked
2 < Connection: keep-alive
2 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
2 < X-Request-ID: kwM8ngeWzKZ7iIHN
{
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td>HAPI-2001: Resource MedicationRequest/INVALID-ID-99999 is not known</td></tr></table></div>"
},
"issue": [ {
"severity": "error",
"code": "processing",
"diagnostics": "HAPI-2001: Resource MedicationRequest/INVALID-ID-99999 is not known"
} ]
}
80
Then status 404
0
81
And match response.resourceType == 'OperationOutcome'
0
82
And match response.issue == '#[_ > 0]'
1
83
* karate.log('404 severity: ' + response.issue[0].severity)
1
03:40:33.357 404 severity: error
84
* karate.log('404 code: ' + response.issue[0].code)
0
03:40:33.357 404 code: processing
Scenario: [8:86]
TC-MED-008 | REQ-GEN-001 captured medication-read.json exists for HL7 Validator
ms: 5009
>>
Background:
15
* url baseUrl
0
03:40:24.353 baseUrl: https://hapi.fhir.org/baseR4
03:40:24.353 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
5007
03:40:24.354 request:
1 > GET https://hapi.fhir.org/baseR4/MedicationRequest?subject%3Amissing=false&_count=1
1 > Host: hapi.fhir.org
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
1 > Accept-Encoding: gzip,deflate
03:40:29.359 response time in milliseconds: 5005
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Thu, 16 Apr 2026 03:40:29 GMT
1 < Content-Type: application/fhir+json;charset=utf-8
1 < Transfer-Encoding: chunked
1 < Connection: keep-alive
1 < X-Cache: HIT from https://hapi.fhir.org/baseR4
1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
1 < X-Request-ID: fDI52K3PDqbiX1h0
1 < Last-Modified: Thu, 16 Apr 2026 03:40:17 GMT
{
"resourceType": "Bundle",
"id": "4d262d36-5c94-49a2-8c3b-1cb3caa31086",
"meta": {
"lastUpdated": "2026-04-16T03:40:17.318+00:00"
},
"type": "searchset",
"link": [ {
"relation": "self",
"url": "https://hapi.fhir.org/baseR4/MedicationRequest?_count=1&subject%3Amissing=false"
}, {
"relation": "next",
"url": "https://hapi.fhir.org/baseR4?_getpages=4d262d36-5c94-49a2-8c3b-1cb3caa31086&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset"
} ],
"entry": [ {
"fullUrl": "https://hapi.fhir.org/baseR4/MedicationRequest/131289270",
"resource": {
"resourceType": "MedicationRequest",
"id": "131289270",
"meta": {
"versionId": "1",
"lastUpdated": "2026-02-26T18:49:38.875+00:00",
"source": "#pcqQcDegw1DzifFo"
},
"contained": [ {
"resourceType": "Practitioner",
"id": "drsmith",
"name": [ {
"family": "Smith",
"given": [ "John" ]
} ]
} ],
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [ {
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "860975",
"display": "Amoxicillin 500mg Capsule"
} ],
"text": "Amoxicillin 500mg Capsule"
},
"subject": {
"reference": "Patient/testmartin",
"display": "Martin Spangenberg"
},
"authoredOn": "2026-02-26",
"requester": {
"reference": "#drsmith",
"display": "Dr. John Smith"
},
"dosageInstruction": [ {
"sequence": 1,
"text": "Take 1 capsule by mouth three times a day for 7 days",
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"route": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/route-codes",
"code": "PO",
"display": "Oral"
} ]
},
"doseAndRate": [ {
"doseQuantity": {
"value": 1,
"unit": "capsule"
}
} ]
} ]
},
"search": {
"mode": "match"
}
} ]
}
19
Then status 200
0
20
* def hasEntry = response.entry != null && response.entry.length > 0
0
21
* match hasEntry == true
0
22
* def medicationId = response.entry[0].resource.id
0
23
* match response.entry[0].resource.resourceType == 'MedicationRequest'
0
24
* karate.log('Resolved medicationId: ' + medicationId)
0
03:40:29.361 Resolved medicationId: 131289270
# karate.write() resolves paths under target/ when running under Maven
88
* def fileExists = java.nio.file.Files.exists(java.nio.file.Paths.get('target/responses/medication/medication-read.json'))
1
89
* assert fileExists == true
0
Scenario: [9:91]
TC-MED-009 | REQ-GEN-003 | REQ-OO-001 malformed JSON returns 400 and OperationOutcome
ms: 10000
>>
Background:
15
* url baseUrl
0
03:40:25.353 baseUrl: https://hapi.fhir.org/baseR4
03:40:25.353 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
5008
03:40:25.354 request:
1 > GET https://hapi.fhir.org/baseR4/MedicationRequest?subject%3Amissing=false&_count=1
1 > Host: hapi.fhir.org
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
1 > Accept-Encoding: gzip,deflate
03:40:30.361 response time in milliseconds: 5006
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Thu, 16 Apr 2026 03:40:30 GMT
1 < Content-Type: application/fhir+json;charset=utf-8
1 < Transfer-Encoding: chunked
1 < Connection: keep-alive
1 < X-Cache: HIT from https://hapi.fhir.org/baseR4
1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
1 < X-Request-ID: fRv3bmDIYPMIADVO
1 < Last-Modified: Thu, 16 Apr 2026 03:40:17 GMT
{
"resourceType": "Bundle",
"id": "4d262d36-5c94-49a2-8c3b-1cb3caa31086",
"meta": {
"lastUpdated": "2026-04-16T03:40:17.318+00:00"
},
"type": "searchset",
"link": [ {
"relation": "self",
"url": "https://hapi.fhir.org/baseR4/MedicationRequest?_count=1&subject%3Amissing=false"
}, {
"relation": "next",
"url": "https://hapi.fhir.org/baseR4?_getpages=4d262d36-5c94-49a2-8c3b-1cb3caa31086&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset"
} ],
"entry": [ {
"fullUrl": "https://hapi.fhir.org/baseR4/MedicationRequest/131289270",
"resource": {
"resourceType": "MedicationRequest",
"id": "131289270",
"meta": {
"versionId": "1",
"lastUpdated": "2026-02-26T18:49:38.875+00:00",
"source": "#pcqQcDegw1DzifFo"
},
"contained": [ {
"resourceType": "Practitioner",
"id": "drsmith",
"name": [ {
"family": "Smith",
"given": [ "John" ]
} ]
} ],
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [ {
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "860975",
"display": "Amoxicillin 500mg Capsule"
} ],
"text": "Amoxicillin 500mg Capsule"
},
"subject": {
"reference": "Patient/testmartin",
"display": "Martin Spangenberg"
},
"authoredOn": "2026-02-26",
"requester": {
"reference": "#drsmith",
"display": "Dr. John Smith"
},
"dosageInstruction": [ {
"sequence": 1,
"text": "Take 1 capsule by mouth three times a day for 7 days",
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"route": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/route-codes",
"code": "PO",
"display": "Oral"
} ]
},
"doseAndRate": [ {
"doseQuantity": {
"value": 1,
"unit": "capsule"
}
} ]
} ]
},
"search": {
"mode": "match"
}
} ]
}
19
Then status 200
0
20
* def hasEntry = response.entry != null && response.entry.length > 0
0
21
* match hasEntry == true
0
22
* def medicationId = response.entry[0].resource.id
0
23
* match response.entry[0].resource.resourceType == 'MedicationRequest'
0
24
* karate.log('Resolved medicationId: ' + medicationId)
0
03:40:30.362 Resolved medicationId: 131289270
# HAPI may return 422 instead of 400 — report as finding if so
93
Given path 'MedicationRequest'
0
94
And header Content-Type = 'application/fhir+json'
0
95
And request 'this is not valid json'
0
96
When method POST
4990
03:40:30.363 request:
2 > POST https://hapi.fhir.org/baseR4/MedicationRequest
2 > Content-Type: application/fhir+json; charset=UTF-8
2 > Content-Length: 22
2 > Host: hapi.fhir.org
2 > Connection: Keep-Alive
2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
2 > Accept-Encoding: gzip,deflate
this is not valid json
03:40:35.352 response time in milliseconds: 4988
2 < 400
2 < Server: nginx/1.24.0 (Ubuntu)
2 < Date: Thu, 16 Apr 2026 03:40:35 GMT
2 < Content-Type: application/fhir+json;charset=utf-8
2 < Transfer-Encoding: chunked
2 < Connection: keep-alive
2 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
2 < X-Request-ID: jJ5sRN50Q4cJZMwW
{
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td>HAPI-0450: Failed to parse request body as JSON resource. Error was: HAPI-1861: Failed to parse JSON encoded FHIR content: HAPI-1859: Content does not appear to be FHIR JSON, first non-whitespace character was: 't' (must be '{')</td></tr></table></div>"
},
"issue": [ {
"severity": "error",
"code": "processing",
"diagnostics": "HAPI-0450: Failed to parse request body as JSON resource. Error was: HAPI-1861: Failed to parse JSON encoded FHIR content: HAPI-1859: Content does not appear to be FHIR JSON, first non-whitespace character was: 't' (must be '{')"
} ]
}
97
Then status 400
0
98
And match response.resourceType == 'OperationOutcome'
0
99
And match response.issue == '#[_ > 0]'
1
Scenario: [10:101]
TC-MED-010 | REQ-GEN-002b meta.versionId is present
ms: 9985
>>
Background:
15
* url baseUrl
0
03:40:29.364 baseUrl: https://hapi.fhir.org/baseR4
03:40:29.364 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
4996
03:40:29.365 request:
1 > GET https://hapi.fhir.org/baseR4/MedicationRequest?subject%3Amissing=false&_count=1
1 > Host: hapi.fhir.org
1 > Connection: Keep-Alive
1 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
1 > Accept-Encoding: gzip,deflate
03:40:34.361 response time in milliseconds: 4995
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Thu, 16 Apr 2026 03:40:34 GMT
1 < Content-Type: application/fhir+json;charset=utf-8
1 < Transfer-Encoding: chunked
1 < Connection: keep-alive
1 < X-Cache: HIT from https://hapi.fhir.org/baseR4
1 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
1 < X-Request-ID: kTdglVjPOHXOewqF
1 < Last-Modified: Thu, 16 Apr 2026 03:40:17 GMT
{
"resourceType": "Bundle",
"id": "4d262d36-5c94-49a2-8c3b-1cb3caa31086",
"meta": {
"lastUpdated": "2026-04-16T03:40:17.318+00:00"
},
"type": "searchset",
"link": [ {
"relation": "self",
"url": "https://hapi.fhir.org/baseR4/MedicationRequest?_count=1&subject%3Amissing=false"
}, {
"relation": "next",
"url": "https://hapi.fhir.org/baseR4?_getpages=4d262d36-5c94-49a2-8c3b-1cb3caa31086&_getpagesoffset=1&_count=1&_pretty=true&_bundletype=searchset"
} ],
"entry": [ {
"fullUrl": "https://hapi.fhir.org/baseR4/MedicationRequest/131289270",
"resource": {
"resourceType": "MedicationRequest",
"id": "131289270",
"meta": {
"versionId": "1",
"lastUpdated": "2026-02-26T18:49:38.875+00:00",
"source": "#pcqQcDegw1DzifFo"
},
"contained": [ {
"resourceType": "Practitioner",
"id": "drsmith",
"name": [ {
"family": "Smith",
"given": [ "John" ]
} ]
} ],
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [ {
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "860975",
"display": "Amoxicillin 500mg Capsule"
} ],
"text": "Amoxicillin 500mg Capsule"
},
"subject": {
"reference": "Patient/testmartin",
"display": "Martin Spangenberg"
},
"authoredOn": "2026-02-26",
"requester": {
"reference": "#drsmith",
"display": "Dr. John Smith"
},
"dosageInstruction": [ {
"sequence": 1,
"text": "Take 1 capsule by mouth three times a day for 7 days",
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"route": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/route-codes",
"code": "PO",
"display": "Oral"
} ]
},
"doseAndRate": [ {
"doseQuantity": {
"value": 1,
"unit": "capsule"
}
} ]
} ]
},
"search": {
"mode": "match"
}
} ]
}
19
Then status 200
0
20
* def hasEntry = response.entry != null && response.entry.length > 0
0
21
* match hasEntry == true
0
22
* def medicationId = response.entry[0].resource.id
0
23
* match response.entry[0].resource.resourceType == 'MedicationRequest'
0
24
* karate.log('Resolved medicationId: ' + medicationId)
0
03:40:34.362 Resolved medicationId: 131289270
102
Given path 'MedicationRequest', medicationId
0
103
When method GET
4987
03:40:34.363 request:
2 > GET https://hapi.fhir.org/baseR4/MedicationRequest/131289270
2 > Host: hapi.fhir.org
2 > Connection: Keep-Alive
2 > User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.18)
2 > Accept-Encoding: gzip,deflate
03:40:39.349 response time in milliseconds: 4985
2 < 200
2 < Server: nginx/1.24.0 (Ubuntu)
2 < Date: Thu, 16 Apr 2026 03:40:39 GMT
2 < Content-Type: application/fhir+json;charset=utf-8
2 < Transfer-Encoding: chunked
2 < Connection: keep-alive
2 < X-Powered-By: HAPI FHIR 8.9.4-SNAPSHOT/eee190b153/2026-02-26 REST Server (FHIR Server; FHIR 4.0.1/R4)
2 < ETag: W/"1"
2 < X-Request-ID: WKIhnY3lQ9tfAfcg
2 < Content-Location: https://hapi.fhir.org/baseR4/MedicationRequest/131289270/_history/1
2 < Last-Modified: Thu, 26 Feb 2026 18:49:38 GMT
{
"resourceType": "MedicationRequest",
"id": "131289270",
"meta": {
"versionId": "1",
"lastUpdated": "2026-02-26T18:49:38.875+00:00",
"source": "#pcqQcDegw1DzifFo"
},
"contained": [ {
"resourceType": "Practitioner",
"id": "drsmith",
"name": [ {
"family": "Smith",
"given": [ "John" ]
} ]
} ],
"status": "active",
"intent": "order",
"medicationCodeableConcept": {
"coding": [ {
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "860975",
"display": "Amoxicillin 500mg Capsule"
} ],
"text": "Amoxicillin 500mg Capsule"
},
"subject": {
"reference": "Patient/testmartin",
"display": "Martin Spangenberg"
},
"authoredOn": "2026-02-26",
"requester": {
"reference": "#drsmith",
"display": "Dr. John Smith"
},
"dosageInstruction": [ {
"sequence": 1,
"text": "Take 1 capsule by mouth three times a day for 7 days",
"timing": {
"repeat": {
"frequency": 3,
"period": 1,
"periodUnit": "d"
}
},
"route": {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/route-codes",
"code": "PO",
"display": "Oral"
} ]
},
"doseAndRate": [ {
"doseQuantity": {
"value": 1,
"unit": "capsule"
}
} ]
} ]
}
104
Then status 200
0
105
And match response.meta.versionId == '#present'
0
106
* karate.log('meta.versionId: ' + response.meta.versionId)
0
03:40:39.350 meta.versionId: 1