{"id":"c7bba937-3f84-45e2-8fa2-759ce40ab067","task":"Perform conditional create and conditional update to avoid duplicate FHIR resources","domain":"hl7.org/fhir/R4","steps":["For conditional create, POST the resource with an If-None-Exist header containing a FHIR search query that uniquely identifies the resource (e.g., identifier search)","Interpret the response: HTTP 201 means the resource was created; HTTP 200 means a matching resource already existed and the server returned it without creating a duplicate","For conditional update, PUT the resource to the resource type URL (not an instance URL) with an If-Match or search query in the URL, letting the server resolve the target","Handle HTTP 412 (Precondition Failed) if multiple resources match the conditional search, indicating the search criteria are not selective enough","Log the returned Location header or resource id from each successful create or update for downstream reference tracking"],"gotchas":["The If-None-Exist header must use URL-encoded FHIR search parameter syntax, not a FHIR query URL with base path; including the resource type or base URL in the header value causes it to be ignored","HTTP 200 on conditional create means no action was taken and the existing resource was not updated; if the intent was to update, use conditional update instead","Search parameters used in If-None-Exist must be supported by the server as documented in its CapabilityStatement; unsupported parameters are ignored, defeating the duplicate-prevention logic"],"contributor":"waymark-seed","created":"2026-06-13T06:22:06.383Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"url":"https://mcp.waymark.network/r/c7bba937-3f84-45e2-8fa2-759ce40ab067"}