process-message

Name Url
process-message https://fhir.nhs.uk/OperationDefinition/MessageHeader-process-message

Invocations

URL: [base]/$process-message

This operation changes content

Parameters (In)

NameCardinalityTypeDocumentation
content1..1Bundle

The message to process

Return Values (Out)

NameCardinalityTypeDocumentation
return0..1OperationOutcome

A response message

This operation does not use the parameters resource; if they are used, and the "content" parameter is always the body of the HTTP message.

When processing messages, a server may return one of several status codes:

  • 200 OK: Indicates that the message has been fully processed. If an application-level response is expected for the submitted message, that response SHALL be returned as the body of the 200 response.
  • 202 Accepted: Indicates that the receiving system has accepted custody of the message
  • 204 No Content: Indicates that the message has been fully processed and would normally have had an application-level response, but because of instructions from the sender (e.g. the messageheader-response-request extension), no response is being provided
  • 300+: Indicates that the message was not successfully processed. The server MAY return an OperationOutcome with additional information, and SHOULD do so if the response code is 400 or greater.
    The client SHALL interpret a 4xx response to indicate that there is no point resubmitting the unaltered message, and a 5xx response to indicate an unexpected error occurred on the part of the server, with the implication that it may be appropriate to resubmit the original message. Doing so SHOULD NOT result in a duplicate message response. Repeated failures indicate either a fatal problem with the submission or a problem with the receiving application.

The following rules apply when using $process-message:

  • The operation only accepts POST transactions - any other HTTP method will result in an HTTP error
  • The request content type submitted is always Bundle with type "message" containing a Message Header resource as the first resource
  • The response content type returned is always OperationOutcome or an HTTP error
  • If the response is an error, the body SHOULD be an Errors ∓ Warning resource with full details
  • The mailbox may be authenticated using standard HTTP authentication methods, including OAuth

The $process-message operation can be used by any HTTP end-point that accepts FHIR messages, not just FHIR RESTful servers.

In order to ensure consistency of processing, the logical rules regarding processing of Bundle.id and message id SHALL be followed when messages are processed using this operation.

The $process-message operation may be used synchronously, or asynchronously.

The following rules apply when using the $process-message operation synchronously:

  • The URL (http://server/base/$process-message) has no parameters
  • It is an error if the sender POSTs a message that requires multiple response messages
  • Servers SHALL accept multiple concurrent message submissions and process them correctly (they are allowed to process them sequentially internally, but multiple concurrent submissions is not an error in its own right)

The following rules apply when using the $process-message operation asynchronously:

  • The URL has at least one parameter: http://server/base/$process-message?async=true
  • The server acknowledges the message with a 200 OK with no body, or returns an HTTP error if the message cannot be processed
  • Accepting the message means that the server has understood the message enough to know where to respond
  • An OperationOutcome SHOULD be returned in either case
  • By default, the server responds by invoking the $process-message using the sender's stated end-point in the message: POST [MessageHeader.source.endpoint]/$process-messages]
  • Since the source end-point may be manipulated by message transfer engines, an alternative response address may be specified using the parameter "response-url": http://server/base/$process-message?async=true&response-url=http://server2.com/base/anything. The endpoint at the specified URL SHALL implement the signature of the $process-message operation (parameter async=true, accept a Bundle, return a 200 OK or an error)
  • The server submits response messages to the appropriate end-point with the parameter async=true. There is no response message for the response messages

{
    "resourceType": "OperationDefinition",
    "id": "MessageHeader-process-message",
    "url": "https://fhir.nhs.uk/OperationDefinition/MessageHeader-process-message",
    "version": "4.0.1",
    "name": "ProcessMessage",
    "status": "draft",
    "kind": "operation",
    "date": "2022-01-07T14:00:00+00:00",
    "publisher": "NHS Digital",
    "contact":  [
        {
            "telecom":  [
                {
                    "system": "email",
                    "value": "interoperabilityteam@nhs.net"
                }
            ]
        }
    ],
    "description": "This operation accepts a message, processes it according to the definition of the event in the message header, and returns one or more response messages.  \n\nIn addition to processing the message event, a server may choose to retain all or some the resources and make them available on a RESTful interface, but is not required to do so.",
    "code": "process-message",
    "comment": "This operation does not use the parameters resource; if they are used, and the \"content\" parameter is always the body of the HTTP message.\n\nWhen processing messages, a server may return one of several status codes:\n* **200 OK**: Indicates that the message has been fully processed.  If an application-level response is expected for the submitted message, that response SHALL be returned as the body of the 200 response.\n* **202 Accepted**: Indicates that the receiving system has accepted custody of the message\n* **204 No Content**: Indicates that the message has been fully processed and would normally have had an application-level response, but because of instructions from the sender (e.g. the [messageheader-response-request](http://hl7.org/fhir/R4/extension-messageheader-response-request.html) extension), no response is being provided\n* **300+**: Indicates that the message was not successfully processed.  The server MAY return an [OperationOutcome](http://hl7.org/fhir/R4/operationoutcome.html) with additional information, and SHOULD do so if the response code is 400 or greater.<br/>\n    The client SHALL interpret a 4xx response to indicate that there is no point resubmitting the unaltered message, and a 5xx response to indicate an unexpected error occurred on the part of the server, with the implication that it may be appropriate to resubmit the original message. Doing so SHOULD NOT result in a duplicate message response. Repeated failures indicate either a fatal problem with the submission or a problem with the receiving application.\n\nThe following rules apply when using $process-message:\n\n* The operation only accepts POST transactions - any other HTTP method will result in an HTTP error\n* The request content type submitted is always [Bundle](http://hl7.org/fhir/R4/bundle.html) with type \"message\" containing a [Message Header](http://hl7.org/fhir/R4/messageheader.html) resource as the first resource\n* The response content type returned is always [OperationOutcome](http://hl7.org/fhir/R4/operationoutcome.html) or an HTTP error\n* If the response is an error, the body SHOULD be an [Errors &mp; Warning](http://hl7.org/fhir/R4/operationoutcome.html) resource with full details\n* The mailbox may be authenticated using standard HTTP authentication methods, including OAuth\n\nThe $process-message operation can be used by any HTTP end-point that accepts FHIR messages, not just FHIR RESTful servers.\n\nIn order to ensure consistency of processing, the [logical rules regarding processing of Bundle.id and message id](http://hl7.org/fhir/R4/messaging.html#reliable) SHALL be followed when messages are processed using this operation.\n\nThe $process-message operation may be used synchronously, or asynchronously.\n\nThe following rules apply when using the $process-message operation synchronously:\n\n* The URL (http://server/base/$process-message) has no parameters\n* It is an error if the sender POSTs a message that requires multiple response messages\n* Servers SHALL accept multiple concurrent message submissions and process them correctly (they are allowed to process them sequentially internally, but multiple concurrent submissions is not an error in its own right)\n\nThe following rules apply when using the $process-message operation asynchronously:\n\n* The URL has at least one parameter: http://server/base/$process-message?async=true\n* The server acknowledges the message with a 200 OK with no body, or returns an HTTP error if the message cannot be processed\n* Accepting the message means that the server has understood the message enough to know where to respond\n* An [OperationOutcome](http://hl7.org/fhir/R4/operationoutcome.html) SHOULD be returned in either case\n* By default, the server responds by invoking the $process-message using the sender's stated end-point in the message: POST [MessageHeader.source.endpoint]/$process-messages]\n* Since the source end-point may be manipulated by message transfer engines, an alternative response address may be specified using the parameter \"response-url\": http://server/base/$process-message?async=true&amp;response-url=http://server2.com/base/anything.  The endpoint at the specified URL SHALL implement the signature of the $process-message operation (parameter async=true, accept a Bundle, return a 200 OK or an error)\n* The server submits response messages to the appropriate end-point with the parameter async=true. There is no response message for the response messages",
    "resource":  [
        "MessageHeader"
    ],
    "system": true,
    "type": false,
    "instance": false,
    "affectsState": true,
    "inputProfile": "https://fhir.nhs.uk/StructureDefinition/NHSDigital-Bundle-FHIRMessage",
    "outputProfile": "https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome",
    "parameter":  [
        {
            "name": "content",
            "use": "in",
            "min": 1,
            "max": "1",
            "documentation": "The message to process",
            "type": "Bundle"
        },
        {
            "name": "return",
            "use": "out",
            "min": 0,
            "max": "1",
            "documentation": "A response message",
            "type": "OperationOutcome"
        }
    ]
}
<OperationDefinition xmlns="http://hl7.org/fhir">
    <id value="MessageHeader-process-message" />
    <url value="https://fhir.nhs.uk/OperationDefinition/MessageHeader-process-message" />
    <version value="4.0.1" />
    <name value="ProcessMessage" />
    <status value="draft" />
    <kind value="operation" />
    <date value="2022-01-07T14:00:00+00:00" />
    <publisher value="NHS Digital" />
    <contact>
        <telecom>
            <system value="email" />
            <value value="interoperabilityteam@nhs.net" />
        </telecom>
    </contact>
    <description value="This operation accepts a message, processes it according to the definition of the event in the message header, and returns one or more response messages.  \n\nIn addition to processing the message event, a server may choose to retain all or some the resources and make them available on a RESTful interface, but is not required to do so." />
    <affectsState value="true" />
    <code value="process-message" />
    <comment value="This operation does not use the parameters resource; if they are used, and the &quot;content&quot; parameter is always the body of the HTTP message.\n\nWhen processing messages, a server may return one of several status codes:\n* **200 OK**: Indicates that the message has been fully processed.  If an application-level response is expected for the submitted message, that response SHALL be returned as the body of the 200 response.\n* **202 Accepted**: Indicates that the receiving system has accepted custody of the message\n* **204 No Content**: Indicates that the message has been fully processed and would normally have had an application-level response, but because of instructions from the sender (e.g. the [messageheader-response-request](http://hl7.org/fhir/R4/extension-messageheader-response-request.html) extension), no response is being provided\n* **300+**: Indicates that the message was not successfully processed.  The server MAY return an [OperationOutcome](http://hl7.org/fhir/R4/operationoutcome.html) with additional information, and SHOULD do so if the response code is 400 or greater.&lt;br/&gt;\n    The client SHALL interpret a 4xx response to indicate that there is no point resubmitting the unaltered message, and a 5xx response to indicate an unexpected error occurred on the part of the server, with the implication that it may be appropriate to resubmit the original message. Doing so SHOULD NOT result in a duplicate message response. Repeated failures indicate either a fatal problem with the submission or a problem with the receiving application.\n\nThe following rules apply when using $process-message:\n\n* The operation only accepts POST transactions - any other HTTP method will result in an HTTP error\n* The request content type submitted is always [Bundle](http://hl7.org/fhir/R4/bundle.html) with type &quot;message&quot; containing a [Message Header](http://hl7.org/fhir/R4/messageheader.html) resource as the first resource\n* The response content type returned is always [OperationOutcome](http://hl7.org/fhir/R4/operationoutcome.html) or an HTTP error\n* If the response is an error, the body SHOULD be an [Errors &amp;mp; Warning](http://hl7.org/fhir/R4/operationoutcome.html) resource with full details\n* The mailbox may be authenticated using standard HTTP authentication methods, including OAuth\n\nThe $process-message operation can be used by any HTTP end-point that accepts FHIR messages, not just FHIR RESTful servers.\n\nIn order to ensure consistency of processing, the [logical rules regarding processing of Bundle.id and message id](http://hl7.org/fhir/R4/messaging.html#reliable) SHALL be followed when messages are processed using this operation.\n\nThe $process-message operation may be used synchronously, or asynchronously.\n\nThe following rules apply when using the $process-message operation synchronously:\n\n* The URL (http://server/base/$process-message) has no parameters\n* It is an error if the sender POSTs a message that requires multiple response messages\n* Servers SHALL accept multiple concurrent message submissions and process them correctly (they are allowed to process them sequentially internally, but multiple concurrent submissions is not an error in its own right)\n\nThe following rules apply when using the $process-message operation asynchronously:\n\n* The URL has at least one parameter: http://server/base/$process-message?async=true\n* The server acknowledges the message with a 200 OK with no body, or returns an HTTP error if the message cannot be processed\n* Accepting the message means that the server has understood the message enough to know where to respond\n* An [OperationOutcome](http://hl7.org/fhir/R4/operationoutcome.html) SHOULD be returned in either case\n* By default, the server responds by invoking the $process-message using the sender&#39;s stated end-point in the message: POST [MessageHeader.source.endpoint]/$process-messages]\n* Since the source end-point may be manipulated by message transfer engines, an alternative response address may be specified using the parameter &quot;response-url&quot;: http://server/base/$process-message?async=true&amp;amp;response-url=http://server2.com/base/anything.  The endpoint at the specified URL SHALL implement the signature of the $process-message operation (parameter async=true, accept a Bundle, return a 200 OK or an error)\n* The server submits response messages to the appropriate end-point with the parameter async=true. There is no response message for the response messages" />
    <resource value="MessageHeader" />
    <system value="true" />
    <type value="false" />
    <instance value="false" />
    <inputProfile value="https://fhir.nhs.uk/StructureDefinition/NHSDigital-Bundle-FHIRMessage" />
    <outputProfile value="https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome" />
    <parameter>
        <name value="content" />
        <use value="in" />
        <min value="1" />
        <max value="1" />
        <documentation value="The message to process" />
        <type value="Bundle" />
    </parameter>
    <parameter>
        <name value="return" />
        <use value="out" />
        <min value="0" />
        <max value="1" />
        <documentation value="A response message" />
        <type value="OperationOutcome" />
    </parameter>
</OperationDefinition>