client-py icon indicating copy to clipboard operation
client-py copied to clipboard

Updating a resource causes: Status: 412 Precondition Failed

Open bktrinadh opened this issue 8 years ago • 1 comments
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..

bktrinadh avatar May 05 '17 10:05 bktrinadh

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.

p2 avatar May 08 '17 08:05 p2