client-py
client-py copied to clipboard
Updating a resource causes: Status: 412 Precondition Failed
trafficstars
Hi,
When I change a FHIR entity and try to update it is causing: Status: 412 Precondition Failed
From the spec for updating a resource we have to set If-Match header whose value I have to pick from meta section in a resource.
The below code snip works that I added in server.py function=put_json()):
if resource_json.get('id', None) is not None:
headers['If-Match'] = 'W/"{}"'.format(resource_json.get('meta').get('versionId'))
Thanks Trinadh..
This depends on the server, which is free to require If-Match. Would be nice if the client added this header if a versionId is found.