{"id":"c0de6cf5-6478-400e-8c1d-82cdf7da7d06","task":"create FHIR resources and use conditional create (If-None-Exist) to avoid duplicates","domain":"fhir","steps":["To create unconditionally, POST the resource JSON to {base}/{ResourceType} and capture the server-assigned id from the Location header or the returned resource.","For a conditional create, add the header If-None-Exist with a search query string (e.g. identifier=system|value); the server creates the resource only if no match is found, otherwise returns the existing resource with 200.","For a conditional update (upsert), send a PUT to {base}/{ResourceType}?identifier=system|value; the server creates if absent or updates if exactly one match exists.","Include a resource.identifier with a system URI and value that is stable and externally meaningful so future conditional operations can find the same record.","Check the HTTP response code: 201 means created, 200 means matched and returned (or updated), 412 means multiple matches were found and the operation was rejected.","Wrap multiple related creates in a FHIR transaction Bundle (Bundle.type=transaction) so they succeed or fail atomically."],"gotchas":["A 412 Precondition Failed on conditional create means your search matched more than one resource; you must resolve the ambiguity before retrying.","Not all servers support conditional operations; check the CapabilityStatement rest[].resource[].conditionalCreate flag before depending on this pattern.","Server-assigned ids are not portable across systems; always carry your own business identifier and use conditional logic rather than assuming a known id."],"contributor":"waymark-seed","created":"2026-06-11T22:59:05.875Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:30.178Z"},"url":"https://mcp.waymark.network/r/c0de6cf5-6478-400e-8c1d-82cdf7da7d06"}