Operation: $set-context

Overview

The $set-context operation is a FHIR operation within the Health Application Lightweight Protocol (HALO) framework, enabling Point of Care (PoC) systems without native FHIR servers or Identity Providers (IdPs) to establish clinical context for a SMART on FHIR Accelerator (SoFA) launch. This operation allows the PoC system to transmit FHIR resources—such as Patient, Encounter, and related context—to the SoFA, where these resources are stored on a centralized jurisdictional FHIR server.

Upon execution, $set-context returns an opaque launchID, which the PoC system includes as a launch parameter in the SMART on FHIR launch URL. The SMART application then uses this launch parameter in its authorization request, enabling the Identity Provider to reference the stored context resources and populate the necessary SMART launch context parameters in the token response.

The context is sent in the form of resource references and miscellaneous parameter values, following the SMART on FHIR launch context parameter structure. Optionally, the PoC system can include actual resource instances within a Bundle in the resources parameter, allowing the SoFA to create and store these resources if needed. This supports scenarios where context resources either exist on the centralized server or are created on-demand, accommodating diverse jurisdictional requirements.

In FHIR, operations are typically invoked with an input Parameters resource in the request body, with the response containing an output Parameters resource. In HALO, the input Parameters resource sent with a $set-context operation request SHALL adhere to the SetContextInputParameters profile, and the output Parameters resource returned in the response SHALL conform to the SetContextOutputParameters profile.

To view the underlying FHIR OperationDefinition resource, see SetContext. To understand how the operation is used, see App Launch. To see how SMART launch context parameters are used in SMART on FHIR, see Launch context arrives with your access_token.

Invocations

URL: [base]/$set-context

Parameters (In)

NameCardinalityTypeDocumentation
appID0..1string

The ID of the SMART App for which the context is being set. This SHALL be the app's ID as listed within the jurisdictional App Catalog. This parameter is optional for the current release of HALO; however, jurisdictions may choose to require its presence. In such cases, the requirement of this parameter will be communicated to PoC vendors out of band.

patient0..1Reference

A reference to the current Patient in context. This SHALL be a reference to a resource contained within the resources Bundle parameter, or a resource that already exists within the SoFA (depending on the Jurisdictional implementation).

encounter0..1Reference

A reference to the current Encounter in context. This SHALL be a reference to a resource contained within the resources Bundle parameter, or a resource that already exists within the SoFA (depending on the Jurisdictional implementation).

fhirContext0..*Reference

References to other resources that are related to the current context. These SHALL be references to resources contained within the resources Bundle parameter, or resources that already exists within the SoFA (depending on the Jurisdictional implementation).

fhirUser0..1Reference

A reference to the user (i.e., PractitionerRole) who is initiating the launch. This will be communicated to the SMART App via the fhirUser claim within the ID Token when the openid or fhirUser scope is requested. This SHALL be a reference to a resource contained within the resources Bundle parameter, or a resource that already exists within the SoFA (depending on the Jurisdictional implementation).

need_patient_banner0..1boolean

The SMART on FHIR need_patient_banner launch context parameter.

intent0..1string

The SMART on FHIR intent launch context parameter.

smart_style_url0..1string

The SMART on FHIR smart_style_url launch context parameter.

tenant0..1string

The SMART on FHIR tenant launch context parameter.

resources0..1Bundle

A SetContextTransactionBundle capturing the resources to be populated within the SoFA as a result of the $set-context operation. The bundle type is transaction and SHALL only contain resources which are covered by and conform to the profiles defined in CA Core+.

Return Values (Out)

NameCardinalityTypeDocumentation
launchID0..1string

An opaque identifier generated for this operation, representing the context set, such as patient or user session information. The launchID SHALL always be populated for a successful $set-context operation.

resourcesResponse0..1Bundle

A SetContextTransactionResponseBundle which communicates the outcome of the create interaction on the SoFA for each resource included in the input transaction Bundle of the $set-context operation. The bundle type is transaction-response and SHALL be present if there was a corresponding Bundle provided in the input and the resulting transaction was successful. If present, the output Bundle SHALL contain one entry per entry in the corresponding input transaction Bundle. This parameter is required if the resources parameter was provided in the input.

outcome1..*OperationOutcome

An OperationOutcome resource detailing the outcome (e.g., success, failure) of the operation.

Determining Resource and Context Requirements for $set-context

Each SMART App within HALO may have unique requirements regarding context and FHIR server access. These requirements are further complicated by the need for the Point of Care (PoC) to predict these needs prior to launch, ensuring it knows which resources and which context must be included in the $set-context operation.

As detailed in the App Catalog page, each application in the catalog includes a scopes property. This property is a list of strings representing the complete set of scopes the application may request upon launch. These scopes are crucial for vendors to determine which data to pre-populate in the SoFA before launch.

When launching a SMART application from the App Catalog as part of the SoFA launch flow, vendors MUST automatically parse the list of scopes and apply the logic outlined in the table below to populate the Parameters resource for the $set-context operation. Whenever possible, PoC vendors SHOULD aim to minimize the health data transmitted by restricting it to the information specified by the scopes.

The table below summarizes the required logic. The Scope column lists the primary scope types defined within SMART on FHIR, the Bundle column provides guidance on the resources to include in the resources Bundle parameter, and the Parameters column specifies the reference parameters to set in the Parameters resource during the $set-context operation.

For a more detailed look at SMART scopes, please see the Scopes and Launch Context page of the SMART App Launch specification.

Scope Bundle Parameters
fhirUser Add a Practitioner, Organization, and Location resources if they are in context, as well as a PractitionerRole resource that references all three. Set the fhirUser parameter to a reference that points to the PractitionerRole resource in the Bundle
launch Add a Patient and Encounter resource if either is in context. Set the patient and encounter parameters to references that point to each of their respective context resources within the Bundle.
launch/patient Add a Patient resource if one is in context. Note that if the launch parameter is present, this scope is redundant. In such cases, PoC vendors MAY ignore this scope. Set the patient parameter to a reference that points to the context Patient in the Bundle
launch/encounter Add an Encounter resource if one is in context. Note that if the launch parameter is present, this scope is redundant. In such cases, PoC vendors MAY ignore this scope. Set the encounter parameter to a reference that points to the context Encounter in the Bundle
launch/[type] Add a resource of the type specified in the [type] section of the scope if one is in context. Add a Reference to the fhirContext parameter that points the related resource within the Bundle.
patient/[type] Add all resources of the type specified in the [type] section of the scope that relate to the current patient in context. N/A
user/[type] Add all resources of the type specified in the [type] section of the scope that the current user has access to. N/A
system/[type] Ignore Ignore
All other scopes Ignore Ignore

Suffixes

In SMART v2, the patient/, user/, and system/ scopes support suffixes such as .c (create), .r (read), .u (update), .d (delete), .s (search), and .* (wildcard/all). The rules that have been described for these scopes above apply only when the suffix includes at least one of .r, .s, or .*, as these are assumed to require access to existing resources within the PoC. If a scopes entry for any of these three types (patient/, user/, or system/) does not include at least one of these suffixes, the PoC SHALL ignore it.

In SMART v1, the patient/, user/, and system/ scope types support .read, .write, and .* suffixes. PoC vendors should first apply the v1 to v2 mapping as outlined in the Scopes and Launch Context page of the SMART App Launch specification, followed by the rules described in the table above.

Resource Type Wildcards

The SMART on FHIR specification allows the use of a wildcard (*) to represent a request for access to perform a given interaction on any resource type (e.g., patient/*.rs provides access to read and search all resources belonging to the current patient in context). While this is supported by SMART on FHIR, the use of such wildcard scopes is not supported within HALO's SoFA launch flow. This restriction exists because, unless the entire patient record is submitted, there is no mechanism for the PoC application to determine in advance which resources it needs to provide. HALO may revisit this requirement in future versions.

Historical Resources

In addition to the standard read and search interactions, SMART on FHIR's .r and .s scopes provide the application with the permission to perform vread and history interactions. This means that if populated, they will have permission to look at past versions of the resources you provide. In HALO, these interactions are not strictly supported or required, and as such, PoC vendors are not required to populate the SoFA with the historical versions of their resources when calling $set-context. Instead, vendors calling $set-context SHALL use the most current version of each resource they submit.

System-level Scopes

In SMART on FHIR, system-level scopes (scopes prefixed with system/) grant access to resources available to the system itself, rather than a specific user. These scopes are designed for use in client credentials flows (e.g., SMART Backend Services) and are not applicable to user-based flows, such as those in the standard SMART App Launch. Consequently, system-level scopes are not supported in this version of HALO, and PoC vendors SHALL disregard them when interpreting scopes to populate the $set-context operation.

Operation Success

Resource ID Mapping

In FHIR, when a transaction Bundle is submitted as part of an operation, the server responds with a corresponding transaction-response Bundle. Each entry in the transaction-response Bundle directly relates to an entry from the original transaction Bundle. This relationship is established through matching entry order, where the first entry in the transaction-response Bundle corresponds to the first entry in the transaction request, the second entry corresponds to the second request entry, and so forth. For resources created as part of the transaction, the server assigns a new unique ID, communicated back through the Bundle.entry.response.location element.

For more information, refer to the Profile: SetContextTransactionBundle and Profile: SetContextTransactionResponseBundle pages in this specification, as well as the FHIR R4 Bundle resource page.

Within the HALO SoFA flow, Point of Care (PoC) vendors SHALL leverage these newly created resource IDs, returned in the SoFA's transaction-response Bundle, to establish and maintain mappings to their local resources. These mappings enable PoC systems to reconcile future write-based notifications initiated by SMART applications via the SoFA Subscription flow, accurately associating them with the appropriate local resources. Each time a resource is included in a call to $set-context, the SoFA FHIR server may assign it a new, distinct ID. Consequently, a single local resource within the PoC may accumulate multiple mappings to these SoFA-generated IDs over time. PoC vendors SHALL ensure their mapping implementations retain all such mappings, explicitly avoiding overwriting or discarding previous mappings, to accurately reconcile future interactions.

Jurisdictional SoFA implementations SHALL ensure that these generated IDs remain globally unique and are never recycled, preserving the integrity of mappings and reconciliation processes within the PoC systems. The specific retention period for these mappings is jurisdictionally determined and SHALL be communicated to PoC vendors as part of their onboarding process.

Note: As outlined in the Processing Notifications section of the Subscriptions page, PoC vendors are also required to maintain similar mappings for new resources created from SoFA Content Update topic notifications.

Operation Failure

If any part of the operation fails, the entire process MUST be rolled back as the $set-context operation is fundamentally transactional in nature. This means that if any step within the underlying FHIR transaction—such as creating the resources—fails, all changes made during the transaction SHALL be reverted. Similarly, if any business logic outside the transaction, such as establishing or setting the context, encounters an error, the entire operation SHALL also be rolled back.

In accordance with HL7's guidance in the base FHIR specification (See Batch/Transaction Response), if the transaction cannot be completed successfully, the SoFA SHALL return an OperationOutcome resource instead of the expected transaction-response Bundle. This transactional behavior ensures that no partial or inconsistent state is left behind, and the entire $set-context operation is treated as a single atomic unit: it either completes fully or fails completely.

If a PoC vendor receives an error in response to invoking the $set-context operation, the user SHALL NOT be allowed to proceed with the app launch. This ensures that users do not unknowingly launch without critical clinical information, safeguarding patient safety and maintaining operational integrity.

HTTP Response Codes

Given that the result of the $set-context operation when there is a transaction-typed Bundle contained in the resources input parameter is equivalent to performing a FHIR transaction interaction, the following transaction-related HTTP status codes as defined within the FHIR HTTP specification are applicable to the $set-context operation:

  • 200 OK - success code - Operation success and transaction success if requested via the resources input parameter.
  • 400 Bad Request - error code - Operation failure due to an issue with one or more of the provided parameters, or a failure at the transaction-level (given the resources parameter was used).
  • 404 Not Found - error code - The client included a resource of a type that is not supported by the $set-context operation, or the server doesn't support this operation.
  • 405 Method Not Allowed - error code - The client included an interaction within the resources parameter Bundle that is not supported by this operation, or the client used the wrong HTTP method when invoking the operation.
  • 422 Unprocessable Entity - error code - The proposed resource violated applicable FHIR profiles or server business rules.

Other standard HTTP status codes such as 401, 403, 409, 412, and 500 may be returned by the SoFA, depending on the jurisdictional SoFA implementation. For more information on how FHIR defines these and other HTTP status codes, see the HTTP section of the base FHIR specification. As more implementations of HALO mature, this list of officially support HTTP status codes may expand with each iteration of the HALO specification.

Examples

Invocation

See the set-context-invocation-example example for more information.

Parameters
{
    "resourceType": "Parameters",
    "id": "set-context-invocation-example",
    "meta": {
        "profile":  [
            "http://fhir.infoway-inforoute.ca/io/HALO/StructureDefinition/set-context-input-parameters"
        ]
    },
    "parameter":  [
        {
            "name": "patient",
            "valueReference": {
                "reference": "urn:uuid:d12004a7-5ed5-41ab-a8f2-0de5f0c98847",
                "type": "Patient"
            }
        },
        {
            "name": "encounter",
            "valueReference": {
                "reference": "urn:uuid:e753f568-6faf-4a9e-aec8-fe0d2a4f397c",
                "type": "Encounter"
            }
        },
        {
            "name": "fhirContext",
            "valueReference": {
                "reference": "urn:uuid:9b530e85-bf64-4f35-a186-65ac1ddaf303",
                "type": "Organization"
            }
        },
        {
            "name": "fhirContext",
            "valueReference": {
                "reference": "urn:uuid:039b0733-79ec-476b-9ccc-109944222d58",
                "type": "Location"
            }
        },
        {
            "name": "fhirUser",
            "valueReference": {
                "reference": "urn:uuid:b3b7f021-6566-4be5-a6ec-736bc44fefb8",
                "type": "PractitionerRole"
            }
        },
        {
            "name": "need_patient_banner",
            "valueBoolean": true
        },
        {
            "name": "intent",
            "valueString": "medication-review"
        },
        {
            "name": "smart_style_url",
            "valueUrl": "http://example.com/smart_v1.json"
        },
        {
            "name": "tenant",
            "valueString": "tenant-xyz"
        },
        {
            "name": "resources",
            "resource": {
                "resourceType": "Bundle",
                "id": "set-context-transaction-bundle-example",
                "meta": {
                    "profile":  [
                        "http://fhir.infoway-inforoute.ca/io/HALO/StructureDefinition/set-context-transaction-bundle"
                    ]
                },
                "type": "transaction",
                "entry":  [
                    {
                        "fullUrl": "urn:uuid:d12004a7-5ed5-41ab-a8f2-0de5f0c98847",
                        "resource": {
                            "resourceType": "Patient",
                            "name":  [
                                {
                                    "use": "official",
                                    "family": "Smith",
                                    "given":  [
                                        "Jane"
                                    ]
                                }
                            ],
                            "gender": "female"
                        },
                        "request": {
                            "method": "POST",
                            "url": "Patient"
                        }
                    },
                    {
                        "fullUrl": "urn:uuid:e753f568-6faf-4a9e-aec8-fe0d2a4f397c",
                        "resource": {
                            "resourceType": "Encounter",
                            "status": "in-progress",
                            "class": {
                                "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
                                "code": "IMP",
                                "display": "inpatient encounter"
                            },
                            "subject": {
                                "reference": "urn:uuid:d12004a7-5ed5-41ab-a8f2-0de5f0c98847",
                                "type": "Patient"
                            }
                        },
                        "request": {
                            "method": "POST",
                            "url": "Encounter"
                        }
                    },
                    {
                        "fullUrl": "urn:uuid:b3b7f021-6566-4be5-a6ec-736bc44fefb8",
                        "resource": {
                            "resourceType": "PractitionerRole",
                            "active": true,
                            "practitioner": {
                                "reference": "urn:uuid:1ba55e38-715b-4072-8608-f5739245e6d8",
                                "type": "Practitioner"
                            },
                            "organization": {
                                "reference": "urn:uuid:9b530e85-bf64-4f35-a186-65ac1ddaf303",
                                "type": "Organization"
                            },
                            "location":  [
                                {
                                    "reference": "urn:uuid:039b0733-79ec-476b-9ccc-109944222d58",
                                    "type": "Location"
                                }
                            ]
                        },
                        "request": {
                            "method": "POST",
                            "url": "PractitionerRole"
                        }
                    },
                    {
                        "fullUrl": "urn:uuid:1ba55e38-715b-4072-8608-f5739245e6d8",
                        "resource": {
                            "resourceType": "Practitioner",
                            "name":  [
                                {
                                    "use": "official",
                                    "family": "Jones",
                                    "given":  [
                                        "Julie"
                                    ],
                                    "suffix":  [
                                        "MD"
                                    ]
                                }
                            ]
                        },
                        "request": {
                            "method": "POST",
                            "url": "Practitioner"
                        }
                    },
                    {
                        "fullUrl": "urn:uuid:9b530e85-bf64-4f35-a186-65ac1ddaf303",
                        "resource": {
                            "resourceType": "Organization",
                            "name": "Example Hospital"
                        },
                        "request": {
                            "method": "POST",
                            "url": "Organization"
                        }
                    },
                    {
                        "fullUrl": "urn:uuid:039b0733-79ec-476b-9ccc-109944222d58",
                        "resource": {
                            "resourceType": "Location",
                            "status": "active",
                            "name": "North Wing",
                            "mode": "instance",
                            "physicalType": {
                                "coding":  [
                                    {
                                        "system": "http://terminology.hl7.org/CodeSystem/location-physical-type",
                                        "code": "wi",
                                        "display": "Wing"
                                    }
                                ]
                            },
                            "managingOrganization": {
                                "reference": "urn:uuid:9b530e85-bf64-4f35-a186-65ac1ddaf303",
                                "type": "Organization"
                            }
                        },
                        "request": {
                            "method": "POST",
                            "url": "Location"
                        }
                    }
                ]
            }
        }
    ]
}
<Parameters xmlns="http://hl7.org/fhir">
    <id value="set-context-invocation-example" />
    <meta>
        <profile value="http://fhir.infoway-inforoute.ca/io/HALO/StructureDefinition/set-context-input-parameters" />
    </meta>
    <parameter>
        <name value="patient" />
        <valueReference>
            <reference value="urn:uuid:d12004a7-5ed5-41ab-a8f2-0de5f0c98847" />
            <type value="Patient" />
        </valueReference>
    </parameter>
    <parameter>
        <name value="encounter" />
        <valueReference>
            <reference value="urn:uuid:e753f568-6faf-4a9e-aec8-fe0d2a4f397c" />
            <type value="Encounter" />
        </valueReference>
    </parameter>
    <parameter>
        <name value="fhirContext" />
        <valueReference>
            <reference value="urn:uuid:9b530e85-bf64-4f35-a186-65ac1ddaf303" />
            <type value="Organization" />
        </valueReference>
    </parameter>
    <parameter>
        <name value="fhirContext" />
        <valueReference>
            <reference value="urn:uuid:039b0733-79ec-476b-9ccc-109944222d58" />
            <type value="Location" />
        </valueReference>
    </parameter>
    <parameter>
        <name value="fhirUser" />
        <valueReference>
            <reference value="urn:uuid:b3b7f021-6566-4be5-a6ec-736bc44fefb8" />
            <type value="PractitionerRole" />
        </valueReference>
    </parameter>
    <parameter>
        <name value="need_patient_banner" />
        <valueBoolean value="true" />
    </parameter>
    <parameter>
        <name value="intent" />
        <valueString value="medication-review" />
    </parameter>
    <parameter>
        <name value="smart_style_url" />
        <valueUrl value="http://example.com/smart_v1.json" />
    </parameter>
    <parameter>
        <name value="tenant" />
        <valueString value="tenant-xyz" />
    </parameter>
    <parameter>
        <name value="resources" />
        <resource>
            <Bundle>
                <id value="set-context-transaction-bundle-example" />
                <meta>
                    <profile value="http://fhir.infoway-inforoute.ca/io/HALO/StructureDefinition/set-context-transaction-bundle" />
                </meta>
                <type value="transaction" />
                <entry>
                    <fullUrl value="urn:uuid:d12004a7-5ed5-41ab-a8f2-0de5f0c98847" />
                    <resource>
                        <Patient>
                            <name>
                                <use value="official" />
                                <family value="Smith" />
                                <given value="Jane" />
                            </name>
                            <gender value="female" />
                        </Patient>
                    </resource>
                    <request>
                        <method value="POST" />
                        <url value="Patient" />
                    </request>
                </entry>
                <entry>
                    <fullUrl value="urn:uuid:e753f568-6faf-4a9e-aec8-fe0d2a4f397c" />
                    <resource>
                        <Encounter>
                            <status value="in-progress" />
                            <class>
                                <system value="http://terminology.hl7.org/CodeSystem/v3-ActCode" />
                                <code value="IMP" />
                                <display value="inpatient encounter" />
                            </class>
                            <subject>
                                <reference value="urn:uuid:d12004a7-5ed5-41ab-a8f2-0de5f0c98847" />
                                <type value="Patient" />
                            </subject>
                        </Encounter>
                    </resource>
                    <request>
                        <method value="POST" />
                        <url value="Encounter" />
                    </request>
                </entry>
                <entry>
                    <fullUrl value="urn:uuid:b3b7f021-6566-4be5-a6ec-736bc44fefb8" />
                    <resource>
                        <PractitionerRole>
                            <active value="true" />
                            <practitioner>
                                <reference value="urn:uuid:1ba55e38-715b-4072-8608-f5739245e6d8" />
                                <type value="Practitioner" />
                            </practitioner>
                            <organization>
                                <reference value="urn:uuid:9b530e85-bf64-4f35-a186-65ac1ddaf303" />
                                <type value="Organization" />
                            </organization>
                            <location>
                                <reference value="urn:uuid:039b0733-79ec-476b-9ccc-109944222d58" />
                                <type value="Location" />
                            </location>
                        </PractitionerRole>
                    </resource>
                    <request>
                        <method value="POST" />
                        <url value="PractitionerRole" />
                    </request>
                </entry>
                <entry>
                    <fullUrl value="urn:uuid:1ba55e38-715b-4072-8608-f5739245e6d8" />
                    <resource>
                        <Practitioner>
                            <name>
                                <use value="official" />
                                <family value="Jones" />
                                <given value="Julie" />
                                <suffix value="MD" />
                            </name>
                        </Practitioner>
                    </resource>
                    <request>
                        <method value="POST" />
                        <url value="Practitioner" />
                    </request>
                </entry>
                <entry>
                    <fullUrl value="urn:uuid:9b530e85-bf64-4f35-a186-65ac1ddaf303" />
                    <resource>
                        <Organization>
                            <name value="Example Hospital" />
                        </Organization>
                    </resource>
                    <request>
                        <method value="POST" />
                        <url value="Organization" />
                    </request>
                </entry>
                <entry>
                    <fullUrl value="urn:uuid:039b0733-79ec-476b-9ccc-109944222d58" />
                    <resource>
                        <Location>
                            <status value="active" />
                            <name value="North Wing" />
                            <mode value="instance" />
                            <physicalType>
                                <coding>
                                    <system value="http://terminology.hl7.org/CodeSystem/location-physical-type" />
                                    <code value="wi" />
                                    <display value="Wing" />
                                </coding>
                            </physicalType>
                            <managingOrganization>
                                <reference value="urn:uuid:9b530e85-bf64-4f35-a186-65ac1ddaf303" />
                                <type value="Organization" />
                            </managingOrganization>
                        </Location>
                    </resource>
                    <request>
                        <method value="POST" />
                        <url value="Location" />
                    </request>
                </entry>
            </Bundle>
        </resource>
    </parameter>
</Parameters>

Success Response

See the set-context-success-response-example example for more information.

Parameters
{
    "resourceType": "Parameters",
    "id": "set-context-success-response-example",
    "meta": {
        "profile":  [
            "http://fhir.infoway-inforoute.ca/io/HALO/StructureDefinition/set-context-output-parameters"
        ]
    },
    "parameter":  [
        {
            "name": "launchID",
            "valueString": "123456"
        },
        {
            "name": "outcome",
            "resource": {
                "resourceType": "OperationOutcome",
                "issue":  [
                    {
                        "severity": "information",
                        "code": "informational",
                        "details": {
                            "text": "Context set successfully"
                        }
                    }
                ]
            }
        },
        {
            "name": "resourcesResponse",
            "resource": {
                "resourceType": "Bundle",
                "id": "set-context-transaction-response-bundle-example",
                "meta": {
                    "profile":  [
                        "http://fhir.infoway-inforoute.ca/io/HALO/StructureDefinition/set-context-transaction-response-bundle"
                    ]
                },
                "type": "transaction-response",
                "entry":  [
                    {
                        "fullUrl": "https://sofa.example.com/R4/Patient/123",
                        "request": {
                            "method": "POST",
                            "url": "Patient"
                        },
                        "response": {
                            "status": "201 Created",
                            "location": "Patient/123/_history/1",
                            "etag": "W/\"1\"",
                            "lastModified": "12/18/2024 22:20:33"
                        }
                    },
                    {
                        "fullUrl": "https://sofa.example.com/R4/Encounter/123",
                        "request": {
                            "method": "POST",
                            "url": "Encounter"
                        },
                        "response": {
                            "status": "201 Created",
                            "location": "Encounter/123/_history/1",
                            "etag": "W/\"1\"",
                            "lastModified": "12/18/2024 22:20:33"
                        }
                    },
                    {
                        "fullUrl": "https://sofa.example.com/R4/PractitionerRole/123",
                        "request": {
                            "method": "POST",
                            "url": "PractitionerRole"
                        },
                        "response": {
                            "status": "201 Created",
                            "location": "PractitionerRole/123/_history/1",
                            "etag": "W/\"1\"",
                            "lastModified": "12/18/2024 22:20:33"
                        }
                    },
                    {
                        "fullUrl": "https://sofa.example.com/R4/Practitioner/123",
                        "request": {
                            "method": "POST",
                            "url": "Practitioner"
                        },
                        "response": {
                            "status": "201 Created",
                            "location": "Practitioner/123/_history/1",
                            "etag": "W/\"1\"",
                            "lastModified": "12/18/2024 22:20:33"
                        }
                    },
                    {
                        "fullUrl": "https://sofa.example.com/R4/Organization/123",
                        "request": {
                            "method": "POST",
                            "url": "Organization"
                        },
                        "response": {
                            "status": "201 Created",
                            "location": "Organization/123/_history/1",
                            "etag": "W/\"1\"",
                            "lastModified": "12/18/2024 22:20:33"
                        }
                    },
                    {
                        "fullUrl": "https://sofa.example.com/R4/Location/123",
                        "request": {
                            "method": "POST",
                            "url": "Location"
                        },
                        "response": {
                            "status": "201 Created",
                            "location": "Location/123/_history/1",
                            "etag": "W/\"1\"",
                            "lastModified": "12/18/2024 22:20:33"
                        }
                    }
                ]
            }
        }
    ]
}
<Parameters xmlns="http://hl7.org/fhir">
    <id value="set-context-success-response-example" />
    <meta>
        <profile value="http://fhir.infoway-inforoute.ca/io/HALO/StructureDefinition/set-context-output-parameters" />
    </meta>
    <parameter>
        <name value="launchID" />
        <valueString value="123456" />
    </parameter>
    <parameter>
        <name value="outcome" />
        <resource>
            <OperationOutcome>
                <issue>
                    <severity value="information" />
                    <code value="informational" />
                    <details>
                        <text value="Context set successfully" />
                    </details>
                </issue>
            </OperationOutcome>
        </resource>
    </parameter>
    <parameter>
        <name value="resourcesResponse" />
        <resource>
            <Bundle>
                <id value="set-context-transaction-response-bundle-example" />
                <meta>
                    <profile value="http://fhir.infoway-inforoute.ca/io/HALO/StructureDefinition/set-context-transaction-response-bundle" />
                </meta>
                <type value="transaction-response" />
                <entry>
                    <fullUrl value="https://sofa.example.com/R4/Patient/123" />
                    <request>
                        <method value="POST" />
                        <url value="Patient" />
                    </request>
                    <response>
                        <status value="201 Created" />
                        <location value="Patient/123/_history/1" />
                        <etag value="W/&quot;1&quot;" />
                        <lastModified value="2024-12-18T22:20:33+00:00" />
                    </response>
                </entry>
                <entry>
                    <fullUrl value="https://sofa.example.com/R4/Encounter/123" />
                    <request>
                        <method value="POST" />
                        <url value="Encounter" />
                    </request>
                    <response>
                        <status value="201 Created" />
                        <location value="Encounter/123/_history/1" />
                        <etag value="W/&quot;1&quot;" />
                        <lastModified value="2024-12-18T22:20:33+00:00" />
                    </response>
                </entry>
                <entry>
                    <fullUrl value="https://sofa.example.com/R4/PractitionerRole/123" />
                    <request>
                        <method value="POST" />
                        <url value="PractitionerRole" />
                    </request>
                    <response>
                        <status value="201 Created" />
                        <location value="PractitionerRole/123/_history/1" />
                        <etag value="W/&quot;1&quot;" />
                        <lastModified value="2024-12-18T22:20:33+00:00" />
                    </response>
                </entry>
                <entry>
                    <fullUrl value="https://sofa.example.com/R4/Practitioner/123" />
                    <request>
                        <method value="POST" />
                        <url value="Practitioner" />
                    </request>
                    <response>
                        <status value="201 Created" />
                        <location value="Practitioner/123/_history/1" />
                        <etag value="W/&quot;1&quot;" />
                        <lastModified value="2024-12-18T22:20:33+00:00" />
                    </response>
                </entry>
                <entry>
                    <fullUrl value="https://sofa.example.com/R4/Organization/123" />
                    <request>
                        <method value="POST" />
                        <url value="Organization" />
                    </request>
                    <response>
                        <status value="201 Created" />
                        <location value="Organization/123/_history/1" />
                        <etag value="W/&quot;1&quot;" />
                        <lastModified value="2024-12-18T22:20:33+00:00" />
                    </response>
                </entry>
                <entry>
                    <fullUrl value="https://sofa.example.com/R4/Location/123" />
                    <request>
                        <method value="POST" />
                        <url value="Location" />
                    </request>
                    <response>
                        <status value="201 Created" />
                        <location value="Location/123/_history/1" />
                        <etag value="W/&quot;1&quot;" />
                        <lastModified value="2024-12-18T22:20:33+00:00" />
                    </response>
                </entry>
            </Bundle>
        </resource>
    </parameter>
</Parameters>

Error Response

See the set-context-error-response-example example for more information.

Parameters
{
    "resourceType": "Parameters",
    "id": "set-context-error-response-example",
    "meta": {
        "profile":  [
            "http://fhir.infoway-inforoute.ca/io/HALO/StructureDefinition/set-context-output-parameters"
        ]
    },
    "parameter":  [
        {
            "name": "outcome",
            "resource": {
                "resourceType": "OperationOutcome",
                "issue":  [
                    {
                        "severity": "error",
                        "code": "processing",
                        "details": {
                            "text": "Failed to set context"
                        }
                    }
                ]
            }
        }
    ]
}
<Parameters xmlns="http://hl7.org/fhir">
    <id value="set-context-error-response-example" />
    <meta>
        <profile value="http://fhir.infoway-inforoute.ca/io/HALO/StructureDefinition/set-context-output-parameters" />
    </meta>
    <parameter>
        <name value="outcome" />
        <resource>
            <OperationOutcome>
                <issue>
                    <severity value="error" />
                    <code value="processing" />
                    <details>
                        <text value="Failed to set context" />
                    </details>
                </issue>
            </OperationOutcome>
        </resource>
    </parameter>
</Parameters>