Release 5 Ballot

This page is part of the FHIR Specification (v5.0.0-ballot: FHIR R5 Ballot Preview). The current version which supercedes this version is 5.0.0. For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4 R3 R2

Example Bundle/bundle-transaction (XML)

FHIR Infrastructure Work GroupMaturity Level: N/AStandards Status: InformativeCompartments: Not linked to any defined compartments

Raw XML (canonical form + also see XML Format Specification)

An example transaction (id = "bundle-transaction")

<?xml version="1.0" encoding="UTF-8"?>

<Bundle xmlns="http://hl7.org/fhir">
  <id value="bundle-transaction"/> 
<!--    this example bundle is a transaction     -->
  <meta> 
    <lastUpdated value="2014-08-18T01:43:30Z"/> 
  <!--    when the transaction was constructed    -->
  </meta> 
  <type value="transaction"/> 
<!--    now, each entry is an action to take in the transaction    -->
  <entry> 
    <fullUrl value="urn:uuid:61ebe359-bfdc-4613-8bf2-c5e300945f0a"/> 
    <resource> 
    <!--    a simple create operation    -->
    <!--    first, the resource to create    -->
      <Patient> 
      <!--    no id for create operations    -->
      <!--    and no metadata on this resource, though it would be valid    -->
        <text> 
          <status value="generated"/> 
          <div xmlns="http://www.w3.org/1999/xhtml">Some narrative</div> 
        </text> 
        <active value="true"/> 
        <name> 
          <use value="official"/> 
          <family value="Chalmers"/> 
          <given value="Peter"/> 
          <given value="James"/> 
        </name> 
        <gender value="male"/> 
        <birthDate value="1974-12-25"/> 
      </Patient> 
    </resource> 
  <!--    now, details about the action to take with the resource    -->
    <request> 
    <!--    POST to [base]/Patient - that's a create    -->
      <method value="POST"/> 
    <!--    actually, in a transaction, you don't specify the [base], 
         so [base]/Patient becomes just 'Patient':    -->
      <url value="Patient"/> 
    </request> 
  </entry> 
  <entry> 
    <fullUrl value="urn:uuid:88f151c0-a954-468a-88bd-5ae15c08e059"/> 
    <resource> 
    <!--    a conditional create operation    -->
    <!--    first, the resource    -->
      <Patient> 
      <!--    no id for create operations    -->
      <!--    and no metadata on this resource, though it would be valid    -->
        <text> 
          <status value="generated"/> 
          <div xmlns="http://www.w3.org/1999/xhtml">Some narrative</div> 
        </text> 
        <identifier> 
          <system value="http:/example.org/fhir/ids"/> 
          <value value="234234"/> 
        </identifier> 
        <active value="true"/> 
        <name> 
          <use value="official"/> 
          <family value="Chalmers"/> 
          <given value="Peter"/> 
          <given value="James"/> 
        </name> 
        <gender value="male"/> 
        <birthDate value="1974-12-25"/> 
      </Patient> 
    </resource> 
  <!--    transaction details    -->
    <request> 
    <!--    POST to [base]/Patient - that's a create    -->
      <method value="POST"/> 
    <!--    actually, in a transaction, you don't specify the [base], 
         so [base]/Patient becomes just 'Patient':    -->
      <url value="Patient"/> 
    <!--    the conditional header: only add this resource if 
      there isn't already one for this patient. If there is one,
      the content of this resource will be ignored    -->
      <ifNoneExist value="identifier=http:/example.org/fhir/ids|234234"/> 
    </request> 
  </entry> 
  <entry> 
    <fullUrl value="http://example.org/fhir/Patient/123"/> 
    <resource> 
    <!--    a simple update operation    -->
    <!--    first, the resource    -->
      <Patient> 
      <!--    the id here and in the URL have to match    -->
        <id value="123"/> 
      <!--    and no metadata on this resource, though it would be valid    -->
        <text> 
          <status value="generated"/> 
          <div xmlns="http://www.w3.org/1999/xhtml">Some narrative</div> 
        </text> 
        <active value="true"/> 
        <name> 
          <use value="official"/> 
          <family value="Chalmers"/> 
          <given value="Peter"/> 
          <given value="James"/> 
        </name> 
        <gender value="male"/> 
        <birthDate value="1974-12-25"/> 
      </Patient> 
    </resource> 
  <!--    transaction details    -->
    <request> 
    <!--    PUT to [base]/Patient/[id] - that's an update    -->
      <method value="PUT"/> 
    <!--    actually, in a transaction, you don't specify the [base], 
         so [base]/Patient becomes just 'Patient':    -->
      <url value="Patient/123"/> 
    </request> 
  </entry> 
  <entry> 
    <fullUrl value="urn:uuid:74891afc-ed52-42a2-bcd7-f13d9b60f096"/> 
    <resource> 
    <!--    a conditional update operation    -->
    <!--    first, the resource    -->
      <Patient> 
      <!--    no id for conditional update operations    -->
      <!--    and no metadata on this resource, though it would be valid    -->
        <text> 
          <status value="generated"/> 
          <div xmlns="http://www.w3.org/1999/xhtml">Some narrative</div> 
        </text> 
        <identifier> 
          <system value="http:/example.org/fhir/ids"/> 
          <value value="456456"/> 
        </identifier> 
        <active value="true"/> 
        <name> 
          <use value="official"/> 
          <family value="Chalmers"/> 
          <given value="Peter"/> 
          <given value="James"/> 
        </name> 
        <gender value="male"/> 
        <birthDate value="1974-12-25"/> 
      </Patient> 
    </resource> 
  <!--    transaction details    -->
    <request> 
    <!--    PUT to [base]/Patient?search_params - that's a conditional update    -->
      <method value="PUT"/> 
    <!--    actually, in a transaction, you don't specify the [base], 
         so [base]/Patient?params becomes just 'Patient?params':    -->
      <url value="Patient?identifier=http:/example.org/fhir/ids|456456"/> 
    </request> 
  </entry> 
  <!--   a different kind of conditional update: version dependent   -->
  <entry> 
    <fullUrl value="http://example.org/fhir/Patient/123a"/> 
    <resource> 
      <Patient> 
        <id value="123a"/> 
        <text> 
          <status value="generated"/> 
          <div xmlns="http://www.w3.org/1999/xhtml">Some narrative</div> 
        </text> 
        <active value="true"/> 
        <name> 
          <use value="official"/> 
          <family value="Chalmers"/> 
          <given value="Peter"/> 
          <given value="James"/> 
        </name> 
        <gender value="male"/> 
        <birthDate value="1974-12-25"/> 
      </Patient> 
    </resource> 
    <request> 
      <method value="PUT"/> 
      <url value="Patient/123a"/> 
      <!--   this will only succeed if the source version is correct:   -->
      <ifMatch value="W/&quot;2&quot;"/> 
    </request> 
  </entry> 
  <entry> 
  <!--    a simple delete operation    -->
  <!--    no resource in this case    -->
  <!--    transaction details    -->
    <request> 
    <!--    DELETE to [base]/Patient/[id]- that's a delete operation    -->
      <method value="DELETE"/> 
    <!--    actually, in a transaction, you don't specify the [base], 
         so [base]/Patient/234 becomes just 'Patient/234':    -->
    <!--    btw, couldn't re-use Patient/123 for the delete, since 
        the transaction couldn't do two different operations on the
        same resource    -->
      <url value="Patient/234"/> 
    </request> 
  </entry> 
  <entry> 
  <!--    a conditional delete operation    -->
  <!--    no resource in this case    -->
  <!--    transaction details    -->
    <request> 
    <!--    DELETE to [base]/Patient?params- that's a conditional delete operation    -->
      <method value="DELETE"/> 
    <!--    actually, in a transaction, you don't specify the [base], 
         so [base]/Patient?params becomes just 'Patient?params':    -->
      <url value="Patient?identifier=123456"/> 
    </request> 
  </entry> 
  <entry> 
    <fullUrl value="urn:uuid:79378cb8-8f58-48e8-a5e8-60ac2755b674"/> 
    <resource> 
    <!--    can do more than just create/update/delete. 
      This is how to invoke an operation with a set of parameters    -->
      <Parameters> 
        <parameter> 
          <name value="coding"/> 
          <valueCoding> 
            <system value="http://loinc.org"/> 
            <code value="1963-8"/> 
          </valueCoding> 
        </parameter> 
      </Parameters> 
    </resource> 
    <request> 
    <!--    POST to [base]/ValueSet/$lookup - invoking a lookup operation (see Terminology Service)
          -->
      <method value="POST"/> 
      <url value="http://hl7.org/fhir/ValueSet/$lookup"/> 
    </request> 
  </entry> 
  <entry> 
  <!--    can also do read-only operations. 
    
    Note that these do not 'fail' - see discussion on transaction 
    atomicity for further information 
       -->
    <request> 
    <!--    GET from [base]/Patient?params - searching for a patient    -->
      <method value="GET"/> 
      <url value="Patient?name=peter"/> 
    </request> 
  </entry> 
  <entry> 
  <!--    and an example conditional read:   -->
    <request> 
      <method value="GET"/> 
      <url value="Patient/12334"/> 
      <!--   in practice, you'd only specify one of these   -->
      <ifNoneMatch value="W/&quot;4&quot;"/> 
      <ifModifiedSince value="2015-08-31T08:14:33+10:00"/> 
    </request> 
  </entry> 
</Bundle> 

Usage note: every effort has been made to ensure that the examples are correct and useful, but they are not a normative part of the specification.