hapi-fhir
hapi-fhir copied to clipboard
ifMatch request param for PATCH request inside a Bundle transaction fails with HAPI-0518 error.
NOTE: Before filing a ticket, please see the following URL: https://github.com/hapifhir/hapi-fhir/wiki/Getting-Help
Describe the bug Including ifMatch with etag value for a PATCH request inside a Bundle transaction causes the transaction to fail. PUT on the other hand works fine.
FYI: Non Bundle Http Patch request against the Patient works fine though.
Failing PATCH request
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [{
"fullUrl": "Patient/e642ec07-c4d1-4f3f-bae6-4cd9e7f9d0d4",
"resource": {
"resourceType": "Binary",
"contentType": "application/json-patch+json",
"data": "W3sib3AiOiJyZXBsYWNlIiwicGF0aCI6IlwvdGVsZWNvbVwvMFwvdmFsdWUiLCJ2YWx1ZSI6IjQwMTEyMzQ1NiJ9XQ=="
},
"request": {
"method": "PATCH",
"url": "Patient/e642ec07-c4d1-4f3f-bae6-4cd9e7f9d0d4",
"ifMatch": "W/\"11\""
}
}]
}
Response
{
"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><pre>HAPI-0518: Invalid match URL[Patient?W/"11"] - URL has no search parameters</pre></td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
},
"issue": [
{
"severity": "error",
"code": "processing",
"diagnostics": "HAPI-0518: Invalid match URL[Patient?W/\"11\"] - URL has no search parameters"
}
]
}
Working PUT Request
{"resourceType":"Bundle","type":"transaction","entry":[{"fullUrl":"Patient/e642ec07-c4d1-4f3f-bae6-4cd9e7f9d0d4","resource":{
"resourceType": "Patient",
"id": "e642ec07-c4d1-4f3f-bae6-4cd9e7f9d0d4",
"active": true,
"name": [
{
"family": "Adams",
"given": [
"Adam"
]
}
],
"telecom": [
{
"system": "phone",
"value": "401123456-01"
}
],
"gender": "male",
"birthDate": "2020-02-14",
"address": [
{
"city": "NAIROBI",
"country": "Kenya"
}
]
},"request":{"method":"PUT","url":"Patient/e642ec07-c4d1-4f3f-bae6-4cd9e7f9d0d4","ifMatch":"W/\"11\""}}]}
Response
{
"resourceType": "Bundle",
"id": "be5b83f0-a3d3-440e-a542-8b9e54e166a6",
"type": "transaction-response",
"link": [
{
"relation": "self",
"url": "http://hapi.fhir.org/baseR4"
}
],
"entry": [
{
"response": {
"status": "200 OK",
"location": "Patient/e642ec07-c4d1-4f3f-bae6-4cd9e7f9d0d4/_history/12",
"etag": "12",
"lastModified": "2022-04-29T18:39:04.724+00:00"
}
}
]
}
To Reproduce Steps to reproduce the behavior:
- Use the requests shown above to do a
POST
request to the https://hapi.fhir.org/baseR4/ and see the response.
Expected behavior Transaction should be successful of if ifMatch has the latest value or fail gracefully for the right reason if the etag provided is not the latest one on the server just like the PUT operation . e.g. Like the PUT response above.
{
"entry": [
{
"response": {
"status": "200 OK",
"location": "Patient/e642ec07-c4d1-4f3f-bae6-4cd9e7f9d0d4/_history/12",
"etag": "12",
"lastModified": "2022-04-29T18:39:04.724+00:00"
}
}
]
}
Screenshots If applicable, add screenshots to help explain your problem.
Environment (please complete the following information): http://hapi.fhir.org/baseR4 HAPI FHIR Test/Demo Server R4 Endpoint HAPI FHIR Server 6.0.0-PRE8-SNAPSHOT/3f58e277e6/2022-03-23
- Browser Chrome & Postman tool
Additional context Add any other context about the problem here.