Scenario: [1:26]
TC-MED-001 | REQ-MED-001 GET /MedicationRequest/{id} returns 200 and resourceType = MedicationRequest
ms: 9998
>>
Background:
15
* url baseUrl
0
21:55:31.230 baseUrl: https://hapi.fhir.org/baseR4
21:55:31.230 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
5026
21:55:31.231 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
21:55:36.256 response time in milliseconds: 5024
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Tue, 21 Apr 2026 21:55:36 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: cuPJ8Ec43RnB6UiQ
1 < Last-Modified: Tue, 21 Apr 2026 21:55:36 GMT
{
"resourceType": "Bundle",
"id": "6f013df6-5f5b-4d0b-931b-19ea37b09674",
"meta": {
"lastUpdated": "2026-04-21T21:55:36.202+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=6f013df6-5f5b-4d0b-931b-19ea37b09674&_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
21:55:36.258 Resolved medicationId: 131289270
27
Given path 'MedicationRequest', medicationId
0
28
When method GET
4968
21:55:36.259 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
21:55:41.225 response time in milliseconds: 4966
2 < 200
2 < Server: nginx/1.24.0 (Ubuntu)
2 < Date: Tue, 21 Apr 2026 21:55:41 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: 1lENsskpJ8kWT8Ji
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')
1
21:55:41.228 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: 9993
>>
Background:
15
* url baseUrl
0
21:55:32.229 baseUrl: https://hapi.fhir.org/baseR4
21:55:32.229 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
5006
21:55:32.231 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
21:55:37.235 response time in milliseconds: 5003
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Tue, 21 Apr 2026 21:55:37 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: hUwnU5nPHH6FYSdF
1 < Last-Modified: Tue, 21 Apr 2026 21:55:36 GMT
{
"resourceType": "Bundle",
"id": "6f013df6-5f5b-4d0b-931b-19ea37b09674",
"meta": {
"lastUpdated": "2026-04-21T21:55:36.202+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=6f013df6-5f5b-4d0b-931b-19ea37b09674&_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
21:55:37.237 Resolved medicationId: 131289270
37
Given path 'MedicationRequest', medicationId
0
38
When method GET
4985
21:55:37.238 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
21:55:42.222 response time in milliseconds: 4984
2 < 200
2 < Server: nginx/1.24.0 (Ubuntu)
2 < Date: Tue, 21 Apr 2026 21:55:42 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: hhz9atkPdBgucWie
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)'
0
41
* karate.log('status: ' + response.status)
0
21:55:42.223 status: active
Scenario: [3:43]
TC-MED-003 | REQ-MED-003 intent is a valid MedicationRequest intent value
ms: 9990
>>
Background:
15
* url baseUrl
0
21:55:33.233 baseUrl: https://hapi.fhir.org/baseR4
21:55:33.234 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
5002
21:55:33.235 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
21:55:38.236 response time in milliseconds: 5000
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Tue, 21 Apr 2026 21:55:38 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: cGYESXSwC4a32qwM
1 < Last-Modified: Tue, 21 Apr 2026 21:55:36 GMT
{
"resourceType": "Bundle",
"id": "6f013df6-5f5b-4d0b-931b-19ea37b09674",
"meta": {
"lastUpdated": "2026-04-21T21:55:36.202+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=6f013df6-5f5b-4d0b-931b-19ea37b09674&_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
21:55:38.237 Resolved medicationId: 131289270
44
Given path 'MedicationRequest', medicationId
0
45
When method GET
4985
21:55:38.238 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
21:55:43.222 response time in milliseconds: 4984
2 < 200
2 < Server: nginx/1.24.0 (Ubuntu)
2 < Date: Tue, 21 Apr 2026 21:55:43 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: J07v4VykejV9rouL
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)'
1
48
* karate.log('intent: ' + response.intent)
0
21:55:43.224 intent: order
Scenario: [4:50]
TC-MED-004 | REQ-MED-004 subject references Patient
ms: 9982
>>
Background:
15
* url baseUrl
0
21:55:34.242 baseUrl: https://hapi.fhir.org/baseR4
21:55:34.242 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
4994
21:55:34.243 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
21:55:39.236 response time in milliseconds: 4993
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Tue, 21 Apr 2026 21:55:39 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: lNpRxZYNPjgrosv2
1 < Last-Modified: Tue, 21 Apr 2026 21:55:36 GMT
{
"resourceType": "Bundle",
"id": "6f013df6-5f5b-4d0b-931b-19ea37b09674",
"meta": {
"lastUpdated": "2026-04-21T21:55:36.202+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=6f013df6-5f5b-4d0b-931b-19ea37b09674&_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
21:55:39.238 Resolved medicationId: 131289270
51
Given path 'MedicationRequest', medicationId
0
52
When method GET
4986
21:55:39.238 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
21:55:44.223 response time in milliseconds: 4984
2 < 200
2 < Server: nginx/1.24.0 (Ubuntu)
2 < Date: Tue, 21 Apr 2026 21:55:44 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: tNmCbKM3290vNMRO
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)
0
21:55:44.225 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
21:55:40.227 baseUrl: https://hapi.fhir.org/baseR4
21:55:40.227 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
5009
21:55:40.228 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
21:55:45.236 response time in milliseconds: 5008
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Tue, 21 Apr 2026 21:55:45 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: Mz7imwzcDT2tbjF0
1 < Last-Modified: Tue, 21 Apr 2026 21:55:36 GMT
{
"resourceType": "Bundle",
"id": "6f013df6-5f5b-4d0b-931b-19ea37b09674",
"meta": {
"lastUpdated": "2026-04-21T21:55:36.202+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=6f013df6-5f5b-4d0b-931b-19ea37b09674&_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
21:55:45.238 Resolved medicationId: 131289270
60
Given path 'MedicationRequest', medicationId
0
61
When method GET
4986
21:55:45.239 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
21:55:50.224 response time in milliseconds: 4984
2 < 200
2 < Server: nginx/1.24.0 (Ubuntu)
2 < Date: Tue, 21 Apr 2026 21:55:50 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: QlYB5fyMzwFkqOF6
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')
0
21:55:50.225 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
21:55:41.231 baseUrl: https://hapi.fhir.org/baseR4
21:55:41.231 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
5004
21:55:41.232 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
21:55:46.235 response time in milliseconds: 5003
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Tue, 21 Apr 2026 21:55:46 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: cOtAAKOPbnODk7JG
1 < Last-Modified: Tue, 21 Apr 2026 21:55:36 GMT
{
"resourceType": "Bundle",
"id": "6f013df6-5f5b-4d0b-931b-19ea37b09674",
"meta": {
"lastUpdated": "2026-04-21T21:55:36.202+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=6f013df6-5f5b-4d0b-931b-19ea37b09674&_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
21:55:46.237 Resolved medicationId: 131289270
71
Given path 'MedicationRequest', medicationId
0
72
When method GET
4986
21:55:46.238 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
21:55:51.223 response time in milliseconds: 4984
2 < 200
2 < Server: nginx/1.24.0 (Ubuntu)
2 < Date: Tue, 21 Apr 2026 21:55:51 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: Umf02QQljoDGndBD
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)
1
21:55:51.224 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: 10008
>>
Background:
15
* url baseUrl
0
21:55:42.227 baseUrl: https://hapi.fhir.org/baseR4
21:55:42.227 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
5008
21:55:42.228 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
21:55:47.235 response time in milliseconds: 5007
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Tue, 21 Apr 2026 21:55:47 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: 9iZmvL4DogHijtpe
1 < Last-Modified: Tue, 21 Apr 2026 21:55:36 GMT
{
"resourceType": "Bundle",
"id": "6f013df6-5f5b-4d0b-931b-19ea37b09674",
"meta": {
"lastUpdated": "2026-04-21T21:55:36.202+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=6f013df6-5f5b-4d0b-931b-19ea37b09674&_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
21:55:47.237 Resolved medicationId: 131289270
78
Given path 'MedicationRequest', 'INVALID-ID-99999'
0
79
When method GET
4995
21:55:47.238 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
21:55:52.233 response time in milliseconds: 4994
2 < 404
2 < Server: nginx/1.24.0 (Ubuntu)
2 < Date: Tue, 21 Apr 2026 21:55:52 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: IPNHX5GqUnrTWosv
{
"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)
0
21:55:52.235 404 severity: error
84
* karate.log('404 code: ' + response.issue[0].code)
0
21:55:52.235 404 code: processing
Scenario: [8:86]
TC-MED-008 | REQ-GEN-001 captured medication-read.json exists for HL7 Validator
ms: 5012
>>
Background:
15
* url baseUrl
0
21:55:43.227 baseUrl: https://hapi.fhir.org/baseR4
21:55:43.227 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
5009
21:55:43.229 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
21:55:48.237 response time in milliseconds: 5007
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Tue, 21 Apr 2026 21:55:48 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: XLrWMNm117eyUVgX
1 < Last-Modified: Tue, 21 Apr 2026 21:55:36 GMT
{
"resourceType": "Bundle",
"id": "6f013df6-5f5b-4d0b-931b-19ea37b09674",
"meta": {
"lastUpdated": "2026-04-21T21:55:36.202+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=6f013df6-5f5b-4d0b-931b-19ea37b09674&_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
21:55:48.239 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
21:55:44.228 baseUrl: https://hapi.fhir.org/baseR4
21:55:44.229 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
5009
21:55:44.230 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
21:55:49.238 response time in milliseconds: 5007
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Tue, 21 Apr 2026 21:55:49 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: A9IDVPw7PKMXYS7P
1 < Last-Modified: Tue, 21 Apr 2026 21:55:36 GMT
{
"resourceType": "Bundle",
"id": "6f013df6-5f5b-4d0b-931b-19ea37b09674",
"meta": {
"lastUpdated": "2026-04-21T21:55:36.202+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=6f013df6-5f5b-4d0b-931b-19ea37b09674&_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
21:55:49.240 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
4987
21:55:49.241 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
21:55:54.227 response time in milliseconds: 4985
2 < 400
2 < Server: nginx/1.24.0 (Ubuntu)
2 < Date: Tue, 21 Apr 2026 21:55:54 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: vPES3KLOTjmE2BWf
{
"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: 9980
>>
Background:
15
* url baseUrl
0
21:55:48.242 baseUrl: https://hapi.fhir.org/baseR4
21:55:48.242 fhirVersion: 4.0.1
16
Given path 'MedicationRequest'
0
17
And params ({ 'subject:missing': 'false', '_count': '1' })
0
18
When method GET
4994
21:55:48.243 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
21:55:53.236 response time in milliseconds: 4992
1 < 200
1 < Server: nginx/1.24.0 (Ubuntu)
1 < Date: Tue, 21 Apr 2026 21:55:53 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: 0kT3CL8V3dha5mN1
1 < Last-Modified: Tue, 21 Apr 2026 21:55:36 GMT
{
"resourceType": "Bundle",
"id": "6f013df6-5f5b-4d0b-931b-19ea37b09674",
"meta": {
"lastUpdated": "2026-04-21T21:55:36.202+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=6f013df6-5f5b-4d0b-931b-19ea37b09674&_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
21:55:53.238 Resolved medicationId: 131289270
102
Given path 'MedicationRequest', medicationId
0
103
When method GET
4984
21:55:53.239 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
21:55:58.222 response time in milliseconds: 4983
2 < 200
2 < Server: nginx/1.24.0 (Ubuntu)
2 < Date: Tue, 21 Apr 2026 21:55:58 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: kwCse02RoAXDxki4
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
21:55:58.223 meta.versionId: 1