Stream: hapi
Topic: patch
Diane (Jun 17 2021 at 00:02):
I am trying to use PATCH to make some data changes on a HAPI server.
I am practicing by attempting to change the family name for the Patient resource with ID 1592932 at test server http://hapi.fhir.org/baseR4/. I am using Postman.
I have never used PATCH before, so I think that I am doing something wrong, especially since my error message is 400 Bad Request.
When I check the conformance, PATCH is supported for the Patient resource, so I ruled that issue out.
I reviewed the FHIR documentation, where I learned about the need for "Content-Type": "application/json-patch+json".
My error message is:
400 Bad Request "diagnostics": "Cannot deserialize value of type java.util.ArrayList<com.github.fge.jsonpatch.operation.JsonPatchOperation>
from Object value (token JsonToken.FIELD_NAME
)\n at [Source: UNKNOWN; line: -1, column: -1]"
I have tried the following for the body of my request:
"patch": [{
"op": "add",
"path": "/name/family",
"value": "Smith-Abernathy"
}]
and
{ "patch": [{
"op": "add",
"path": "/name/family,
"value": "Smith-Abernathy"
}]
}
and
{
"op": "add",
"path": "/name/family,
"value": "Smith-Abernathy"
}
Dexter (Jun 24 2021 at 12:24):
It should be a list of items
[
{
"op": "add",
"path": "/name/family,
"value": "Smith-Abernathy"
},
// and so on
]
Diane (Jun 25 2021 at 17:50):
Thank you @Dexter A list of items is what was needed. This cleared up the 400 Bad Request "diagnostics": "Cannot deserialize value error.
Last updated: Apr 12 2022 at 19:14 UTC