From bbea913abe723cb3543cfffe0a7f5d6ef7d229d9 Mon Sep 17 00:00:00 2001 From: gered Date: Mon, 14 Jul 2014 15:22:17 -0400 Subject: [PATCH] add update resource function --- src/clj_hl7_fhir/core.clj | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/clj_hl7_fhir/core.clj b/src/clj_hl7_fhir/core.clj index 56c1e88..66f1bff 100644 --- a/src/clj_hl7_fhir/core.clj +++ b/src/clj_hl7_fhir/core.clj @@ -284,6 +284,17 @@ (apply join-paths uri-components) :body resource))) +(defn update + [base-url type id resource & {:keys [version]}] + (let [resource-name (->fhir-resource-name type) + uri-components (if version + ["/" resource-name id "_history" version] + ["/" resource-name id])] + (fhir-request :put + base-url + (apply join-paths uri-components) + :body resource))) + ;(def server-url "http://fhir.healthintersections.com.au/open") ;(def server-url "http://spark.furore.com/fhir") ;(def server-url "http://fhirtest.uhn.ca/base")