Re: Updating a resource causes: Status: 412 Precondition Failed

193 views
Skip to first unread message

Syed,Jenni

unread,
Apr 18, 2017, 9:48:55 AM4/18/17
to tri...@cura.tech, cerner-fhir...@googlegroups.com

Hi. First: your posts are getting marked as spam, which causes them to go into holding. I’m responding on this one via the old email notification because it sounds like there’s been some confusion around posts being deleted (we assumed you were deleting them since you didn’t see them immediately). If something goes to spam, just give it some time and it will be released by a moderator.

 

As to your question:

 

In your error post below, you can see the response:

 

“> no If-Match or invalid If-Match header provided”

 

To update, you must send the If-Match[1] header with the version of the AllergyIntolerance that you’re updating. This can be found in the AllergyIntolerance.meta.versionId field when you read it. You then take that value and create an If-Match looking like this:

 

If-Match: W/”[versionId]”

 

If the resource has been updated since you read it by someone else, you’ll get a 409/conflict – your code will need to handle this gracefully.

 

Our doc [2] currently states it’s the allergy id, which is incorrect and quite confusing. We’ll get that updated.

 

~ Jenni

 

[1] http://hl7.org/fhir/dstu2/http.html#concurrency

[2] http://fhir.cerner.com/millennium/dstu2/general-clinical/allergy-intolerance/#headers-1

 

From: <cerner-fhir...@googlegroups.com> on behalf of "tri...@cura.tech" <tri...@cura.tech>
Date: Wednesday, April 12, 2017 at 8:00 AM
To: Cerner FHIR Developers <cerner-fhir...@googlegroups.com>
Subject: Updating a resource causes: Status: 412 Precondition Failed

 

I read the list of Allergies of a patient. I have the option to create or update an existing record. The create is working fine but on update I am getting an error below. Is there anything that I am missing? The request/response headers are below.

< PUT /dstu2/0b8a0111-e8e6-4c26-a91c-5069cbc6b1ca/AllergyIntolerance/6215743 HTTP/1.1
< Host: fhir-ehr.sandboxcerner.com
< Connection: keep-alive
< Accept-Encoding: gzip, deflate
< Accept: application/json+fhir
< User-Agent: python-requests/2.13.0
< Accept-Charset: UTF-8
< Content-type: application/json+fhir
< Authorization: Bearer eyJraWQiOiIyMDE3LTA0LTEwVDE0OjEwOjA2LjU3Mi5lYyIsInR5cCI6IkpXVCIsImFsZyI6IkVTMjU2In0.eyJzdWIiOiJwb3J0YWw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ZlcmVuY2Uud3JpdGUgdXNlclwvTWVkaWNhdGlvblN0YXRlbWVudC53cml0ZSJ9fSwiY2xpZW50Ijp7Im5hbWUiOiJzbWFydF9maGlyX3BvYyIsImlkIjoiZmNmOGQxMGUtMzY0NS00ZDE4LTgzNGMtN2RlNTEzM2FkODdhIn0sInVzZXIiOnsicHJpbmNpcGFsIjoicG9ydGFsIiwicGVyc29uYSI6InByb3ZpZGVyIiwiaWRzcCI6IjBiOGEwMTExLWU4ZTYtNGMyNi1hOTFjLTUwNjljYmM2YjFjYSIsInByaW5jaXBhbFVyaSI6Imh0dHBzOlwvXC9taWxsZW5uaWEuc2FuZGJveGNlcm5lci5jb21cL2luc3RhbmNlXC8wYjhhMDExMS1lOGU2LTRjMjYtYTkxYy01MDY5Y2JjNmIxY2FcL3ByaW5jaXBhbFwvMDAwMC4wMDAwLjAwNDQuMUQ4NyIsImlkc3BVcmkiOiJodHRwczpcL1wvbWlsbGVubmlhLnNhbmRib3hjZXJuZXIuY29tXC9hY2NvdW50c1wvZmhpcnBsYXkudGVtcF9yaG8uY2VybmVyYXNwLmNvbVwvMGI4YTAxMTEtZThlNi00YzI2LWE5MWMtNTA2OWNiYzZiMWNhXC9sb2dpbiJ9LCJ0ZW5hbnQiOiIwYjhhMDExMS1lOGU2LTRjMjYtYTkxYy01MDY5Y2JjNmIxY2EifX0.p-0sCEIWc7gM53VlEJ854T7dDjgGYq5eeX54U372UmordKMBCOAuD9sgWtz5HYrwOApRrXVa3a-cU220P6PjjQ
< Content-Length: 340
<
< {"category": "medication", "status": "unconfirmed", "substance": {"coding": [{"code": "102002", "system": "http://snomed.info/sct"}]}, "patient": {"reference": "Patient/4478007"}, "criticality": "CRITH", "resourceType": "AllergyIntolerance", "onset": "2017-04-12", "recordedDate": "2017-04-12T12:00:45Z", "type": "allergy", "id": "6215743"}
> HTTP/1.1 412 Precondition Failed
> Date: Wed, 12 Apr 2017 12:50:38 GMT
> Cache-Control: no-cache
> Vary: Origin,User-Agent,Accept-Encoding
> Strict-Transport-Security: max-age=631152000
> Server-Response-Time: 15.079538
> X-XSS-Protection: 1; mode=block
> Pragma: no-cache
> X-Request-Id: 2068a8221c66f23e36d7a87fc70bea71
> X-Runtime: 0.015052
> X-Frame-Options: SAMEORIGIN
> X-Content-Type-Options: nosniff
> Expires: Mon, 01 Jan 1990 00:00:00 GMT
> Status: 412 Precondition Failed
> Content-Type: text/plain; charset=utf-8
> Keep-Alive: timeout=15, max=100
> Connection: Keep-Alive
> Transfer-Encoding: chunked
>
no If-Match or invalid If-Match header provided

--
You received this message because you are subscribed to the Google Groups "Cerner FHIR Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cerner-fhir-devel...@googlegroups.com.
To post to this group, send email to cerner-fhir...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cerner-fhir-developers/dd57e43c-ad83-4325-865c-b27c9091f30e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

CONFIDENTIALITY NOTICE This message and any included attachments are from Cerner Corporation and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.

Trinadh Baranika

unread,
Apr 18, 2017, 12:08:36 PM4/18/17
to Syed,Jenni, cerner-fhir...@googlegroups.com
I am surprised as my earlier communication never went into spam. I will check my mail settings.

I will test with if-match that you have suggested. I was reading the document and it was suggesting to use etag and I was for some reason was thinking that the required etag is necessary to set If-Match

Thanks
Trinadh..

To unsubscribe from this group and stop receiving emails from it, send an email to cerner-fhir-developers+unsub...@googlegroups.com.
To post to this group, send email to cerner-fhir-developers@googlegroups.com.

Jenni Syed (Cerner)

unread,
Apr 18, 2017, 12:38:19 PM4/18/17
to Cerner FHIR Developers, Jenni...@cerner.com
Note: it went into the google group spam (not your email spam) - which means it won't show on the group until we release it. When we released it, the post for some reason had already been deleted.
Reply all
Reply to author
Forward
0 new messages