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
Known 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
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp