FHIR
Since Camel 2.23
Both producer and consumer are supported
The FHIR component integrates with the HAPI-FHIR library, which is an open-source implementation of the FHIR (Fast Healthcare Interoperability Resources) specification in Java.
Maven users will need to add the following dependency to their pom.xml for this component:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-fhir</artifactId>
<version>${camel-version}</version>
</dependency> URI Format
The FHIR Component uses the following URI format:
fhir://endpoint-prefix/endpoint?[options]
Endpoint prefix can be one of:
-
capabilities
-
create
-
delete
-
history
-
load-page
-
meta
-
operation
-
patch
-
read
-
search
-
transaction
-
update
-
validate
Configuring Options
Camel components are configured on two separate levels:
-
component level
-
endpoint level
Configuring Component Options
At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.
For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
You can configure components using:
-
the Component DSL.
-
in a configuration file (
application.properties,*.yamlfiles, etc). -
directly in the Java code.
Configuring Endpoint Options
You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.
A good practice when configuring options is to use Property Placeholders.
Property placeholders provide a few benefits:
-
They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.
-
They allow externalizing the configuration from the code.
-
They help the code to become more flexible and reusable.
The following two sections list all the options, firstly for the component followed by the endpoint.
Component Options
The FHIR component supports the following options which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
The encoding of the request bodies and of the responses that the client asks the server for, with the Accept header and, on GET requests, the _format parameter. When not set, the requests are encoded as JSON. Enum values:
| String | ||
The FHIR version of the server and of the HAPI FHIR model classes, used to create the FhirContext. Not used when fhirContext or client is set. Enum values:
| R4 | String | |
Whether to log the summary, headers and body of each request and response, with the HAPI FHIR LoggingInterceptor. | false | boolean | |
Whether to pretty-print the request bodies and to ask the server for pretty-printed responses with the _pretty=true parameter. | false | boolean | |
The base URL of the FHIR server, such as http://localhost:8080/fhir. Required unless client is set. | String | ||
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean | |
The HAPI FHIR IGenericClient to use. When set, the endpoint uses it as is and the options that configure the client, such as serverUrl, the timeouts and the authentication, are not used. | IGenericClient | ||
The HAPI FHIR IRestfulClientFactory that the FhirContext uses to create the HTTP client. The timeout, proxy and validationMode options are applied to it. | IRestfulClientFactory | ||
Whether to compress the request bodies (of POST, PUT and PATCH requests) with GZIP, and set the Content-Encoding: gzip header. | false | boolean | |
The shared configuration of the endpoints: the options set in it apply to every endpoint, unless the endpoint sets them. | FhirConfiguration | ||
The timeout in milliseconds to establish the TCP connection to the server. | 10000 | Integer | |
Whether the FhirContext scans a model class for its children only when they are first accessed, rather than up front. This makes the startup faster. | false | boolean | |
The HAPI FHIR FhirContext to use. A FhirContext is expensive to create, so set it to share one between endpoints. When set, fhirVersion is not used. | FhirContext | ||
Whether to fetch and check the capability statement of the server when the endpoint creates its client, whatever validationMode is set to. | false | boolean | |
The value of the Cookie header to add to each request, such as name=value for an HTTP session cookie. | String | ||
The socket timeout in milliseconds: the longest time to wait for data from the server. | 10000 | Integer | |
Asks the server to return a summary of the resources with the _summary parameter on each request: COUNT (only the count of matches), TEXT (only the text, id, meta and mandatory elements), DATA (all elements but the text), TRUE (only the elements marked as summary) or FALSE (all elements). Enum values:
| String | ||
Whether the client fetches the capability statement (metadata) of the server and checks its FHIR version before the first request to that server: ONCE does it once for each server base URL, NEVER does not. Enum values:
| ONCE | String | |
The host of the HTTP proxy to connect through. Used only together with proxyPort. | String | ||
The password to authenticate to the HTTP proxy with, used when proxyUser is set. | String | ||
The port of the HTTP proxy to connect through. Used only together with proxyHost. | Integer | ||
The user name to authenticate to the HTTP proxy with. | String | ||
The access token sent as a bearer token in the Authorization header of each request, such as an OAuth 2.0 access token. | String | ||
The password for HTTP basic authentication, used when username is set. | String | ||
The user name for HTTP basic authentication. The password option is used with it. | String |
Endpoint Options
The FHIR endpoint is configured using URI syntax:
fhir:apiName/methodName
With the following path and query parameters:
Path Parameters
| Name | Description | Default | Type |
|---|---|---|---|
Required The API to use: capabilities, create, delete, history, load-page, meta, operation, patch, read, search, transaction, update or validate. Enum values:
| FhirApiName | ||
Required The method of the API to call, such as resourceById for read or searchByUrl for search. | String |
Query Parameters
| Name | Description | Default | Type |
|---|---|---|---|
The encoding of the request bodies and of the responses that the client asks the server for, with the Accept header and, on GET requests, the _format parameter. When not set, the requests are encoded as JSON. Enum values:
| String | ||
The FHIR version of the server and of the HAPI FHIR model classes, used to create the FhirContext. Not used when fhirContext or client is set. Enum values:
| R4 | String | |
Sets the name of a parameter to be passed in the exchange In Body. | String | ||
Whether to log the summary, headers and body of each request and response, with the HAPI FHIR LoggingInterceptor. | false | boolean | |
Whether to pretty-print the request bodies and to ask the server for pretty-printed responses with the _pretty=true parameter. | false | boolean | |
The base URL of the FHIR server, such as http://localhost:8080/fhir. Required unless client is set. | String | ||
If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead. | false | boolean | |
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | ExceptionHandler | ||
Sets the exchange pattern when the consumer creates an exchange. Enum values:
| ExchangePattern | ||
A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel. | PollingConsumerPollStrategy | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
The HAPI FHIR IGenericClient to use. When set, the endpoint uses it as is and the options that configure the client, such as serverUrl, the timeouts and the authentication, are not used. | IGenericClient | ||
The HAPI FHIR IRestfulClientFactory that the FhirContext uses to create the HTTP client. The timeout, proxy and validationMode options are applied to it. | IRestfulClientFactory | ||
Whether to compress the request bodies (of POST, PUT and PATCH requests) with GZIP, and set the Content-Encoding: gzip header. | false | boolean | |
The timeout in milliseconds to establish the TCP connection to the server. | 10000 | Integer | |
Whether the FhirContext scans a model class for its children only when they are first accessed, rather than up front. This makes the startup faster. | false | boolean | |
The HAPI FHIR FhirContext to use. A FhirContext is expensive to create, so set it to share one between endpoints. When set, fhirVersion is not used. | FhirContext | ||
Whether to fetch and check the capability statement of the server when the endpoint creates its client, whatever validationMode is set to. | false | boolean | |
The value of the Cookie header to add to each request, such as name=value for an HTTP session cookie. | String | ||
The socket timeout in milliseconds: the longest time to wait for data from the server. | 10000 | Integer | |
Asks the server to return a summary of the resources with the _summary parameter on each request: COUNT (only the count of matches), TEXT (only the text, id, meta and mandatory elements), DATA (all elements but the text), TRUE (only the elements marked as summary) or FALSE (all elements). Enum values:
| String | ||
Whether the client fetches the capability statement (metadata) of the server and checks its FHIR version before the first request to that server: ONCE does it once for each server base URL, NEVER does not. Enum values:
| ONCE | String | |
The host of the HTTP proxy to connect through. Used only together with proxyPort. | String | ||
The password to authenticate to the HTTP proxy with, used when proxyUser is set. | String | ||
The port of the HTTP proxy to connect through. Used only together with proxyHost. | Integer | ||
The user name to authenticate to the HTTP proxy with. | String | ||
The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in. | int | ||
The number of subsequent idle polls that should happen before the backoffMultipler should kick-in. | int | ||
To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again. When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured. | int | ||
Milliseconds before the next poll. | 500 | long | |
If greedy is enabled, then the ScheduledPollConsumer will run immediately again, if the previous run polled 1 or more messages. | false | boolean | |
How long a poll may run before the health check of the consumer reports DOWN. The health check is otherwise based on the polls that are done, so it stays UP while a poll hangs, for example on a read without timeout from a connection that went silent. A poll includes routing the messages it polled, so set this above the longest poll you expect. The poll is not interrupted. The value is in millis (not affected by timeUnit). The default 0 turns this off. | 0 | long | |
Milliseconds before the first poll starts. | 1000 | long | |
Specifies a maximum limit of number of fires. So if you set it to 1, the scheduler will only fire once. If you set it to 5, it will only fire five times. A value of zero or negative means fire forever. | 0 | long | |
The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that. Enum values:
| TRACE | LoggingLevel | |
Allows for configuring a custom/shared thread pool to use for the consumer. By default each consumer has its own single threaded thread pool. | ScheduledExecutorService | ||
To use a cron scheduler from either camel-spring or camel-quartz component. Use value spring or quartz for built in scheduler. | none | Object | |
To configure additional properties when using a custom scheduler or any of the Quartz, Spring based scheduler. This is a multi-value option with prefix: scheduler. | Map | ||
Whether the scheduler should be auto started. | true | boolean | |
Time unit for initialDelay and delay options. Enum values:
| MILLISECONDS | TimeUnit | |
Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details. | true | boolean | |
The access token sent as a bearer token in the Authorization header of each request, such as an OAuth 2.0 access token. | String | ||
The password for HTTP basic authentication, used when username is set. | String | ||
The user name for HTTP basic authentication. The password option is used with it. | String |
API Parameters (13 APIs)
The FHIR endpoint is an API-based component and has additional parameters based on which API name and API method is used. The API name and API method is located in the endpoint URI as the apiName/methodName path parameters:
fhir:apiName/methodName
There are 13 API names as listed in the table below:
| API Name | Type | Description |
|---|---|---|
Both | API to fetch the capability statement (metadata) of the server | |
Both | API for the create operation, which creates a new resource on the server | |
Both | API for the delete operation, which deletes resources on the server | |
Both | API for the history operation, which fetches the versions of resources | |
Both | API to load the next or previous page of a paged result, such as a search, or a page by its URL | |
Both | API for the meta operations, which get, add and remove the tags, profiles and security labels of resources | |
Both | API to invoke extended FHIR operations, such as $everything, on the server, a resource type or a resource | |
Both | API for the patch operation, which applies a patch to a resource on the server | |
Both | API to read a resource from the server, by its ID or by its URL | |
Both | API to search for resources matching a given set of criteria | |
Both | API for sending a transaction (collection of resources) to the server to be executed as a single unit | |
Both | API for the update operation, which updates a resource on the server | |
Both | API to validate resources with the $validate operation of the server |
Each API is documented in the following sections to come.
API: capabilities
Both producer and consumer are supported
The capabilities API is defined in the syntax as follows:
fhir:capabilities/methodName?[parameters] The 1 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Fetches the capability statement of the server, from [base]/metadata |
Method ofType
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseConformance ofType(Class<org.hl7.fhir.instance.model.api.IBaseConformance> type, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/ofType API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
type | The capability statement class of the FHIR version, such as org.hl7.fhir.r4.model.CapabilityStatement | Class |
In addition to the parameters above, the fhir API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelFhir.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelFhir.myParameterNameHere header.
API: create
Both producer and consumer are supported
The create API is defined in the syntax as follows:
fhir:create/methodName?[parameters] The 1 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Creates a resource on the server |
Method resource
Signatures:
-
ca.uhn.fhir.rest.api.MethodOutcome resource(String resourceAsString, String url, ca.uhn.fhir.rest.api.PreferReturnEnum preferReturn, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
-
ca.uhn.fhir.rest.api.MethodOutcome resource(org.hl7.fhir.instance.model.api.IBaseResource resource, String url, ca.uhn.fhir.rest.api.PreferReturnEnum preferReturn, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/resource API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
preferReturn | The value of the Prefer header, which asks the server what to return: REPRESENTATION (the resource, then available from MethodOutcome.getResource()), MINIMAL (nothing) or OPERATION_OUTCOME (an OperationOutcome), or null to send no Prefer header | PreferReturnEnum |
resource | The resource to create | IBaseResource |
resourceAsString | The resource to create, as JSON or XML text | String |
url | A search URL of the form [ResourceType]?[Parameters], such as Patient?identifier=123, which makes it a conditional create: the server creates the resource only if no resource matches the URL. May be null | String |
In addition to the parameters above, the fhir API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelFhir.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelFhir.myParameterNameHere header.
API: delete
Both producer and consumer are supported
The delete API is defined in the syntax as follows:
fhir:delete/methodName?[parameters] The 3 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Deletes the given resource, which is identified by its ID | ||
Deletes the resource with the given ID | ||
Deletes the resources that match the given search URL (a conditional delete) |
Method resource
Signatures:
-
ca.uhn.fhir.rest.api.MethodOutcome resource(org.hl7.fhir.instance.model.api.IBaseResource resource, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/resource API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
resource | The resource to delete, which must have an ID | IBaseResource |
Method resourceById
Signatures:
-
ca.uhn.fhir.rest.api.MethodOutcome resourceById(String type, String stringId, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
-
ca.uhn.fhir.rest.api.MethodOutcome resourceById(org.hl7.fhir.instance.model.api.IIdType id, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/resourceById API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
id | The ID of the resource, with its resource type, such as Patient/123 | IIdType |
stringId | The ID of the resource, such as 123 | String |
type | The resource type, such as Patient | String |
Method resourceConditionalByUrl
Signatures:
-
ca.uhn.fhir.rest.api.MethodOutcome resourceConditionalByUrl(String url, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/resourceConditionalByUrl API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
url | The search URL of the resources to delete, of the form [ResourceType]?[Parameters], such as Patient?identifier=123 | String |
In addition to the parameters above, the fhir API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelFhir.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelFhir.myParameterNameHere header.
API: history
Both producer and consumer are supported
The history API is defined in the syntax as follows:
fhir:history/methodName?[parameters] The 3 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Fetches the history of the given resource | ||
Fetches the history of all the resources on the server | ||
Fetches the history of all the resources of the given type |
Method onInstance
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseBundle onInstance(org.hl7.fhir.instance.model.api.IIdType id, Class<org.hl7.fhir.instance.model.api.IBaseBundle> returnType, Integer count, java.util.Date cutoff, org.hl7.fhir.instance.model.api.IPrimitiveType<java.util.Date> iCutoff, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/onInstance API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
count | The maximum number of resource versions to return (the _count parameter), or null to let the server decide | Integer |
cutoff | The time from which to return the resource versions: only those created at or after it (the _since parameter), or null for all versions | Date |
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
iCutoff | The same as cutoff, as a FHIR instant or dateTime type, or null | IPrimitiveType |
id | The ID of the resource, with its resource type, such as Patient/123 | IIdType |
returnType | The Bundle class of the FHIR version to return the history in, such as org.hl7.fhir.r4.model.Bundle | Class |
Method onServer
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseBundle onServer(Class<org.hl7.fhir.instance.model.api.IBaseBundle> returnType, Integer count, java.util.Date cutoff, org.hl7.fhir.instance.model.api.IPrimitiveType<java.util.Date> iCutoff, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/onServer API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
count | The maximum number of resource versions to return (the _count parameter), or null to let the server decide | Integer |
cutoff | The time from which to return the resource versions: only those created at or after it (the _since parameter), or null for all versions | Date |
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
iCutoff | The same as cutoff, as a FHIR instant or dateTime type, or null | IPrimitiveType |
returnType | The Bundle class of the FHIR version to return the history in, such as org.hl7.fhir.r4.model.Bundle | Class |
Method onType
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseBundle onType(Class<org.hl7.fhir.instance.model.api.IBaseResource> resourceType, Class<org.hl7.fhir.instance.model.api.IBaseBundle> returnType, Integer count, java.util.Date cutoff, org.hl7.fhir.instance.model.api.IPrimitiveType<java.util.Date> iCutoff, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/onType API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
count | The maximum number of resource versions to return (the _count parameter), or null to let the server decide | Integer |
cutoff | The time from which to return the resource versions: only those created at or after it (the _since parameter), or null for all versions | Date |
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
iCutoff | The same as cutoff, as a FHIR instant or dateTime type, or null | IPrimitiveType |
resourceType | The resource type, as a class such as org.hl7.fhir.r4.model.Patient | Class |
returnType | The Bundle class of the FHIR version to return the history in, such as org.hl7.fhir.r4.model.Bundle | Class |
In addition to the parameters above, the fhir API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelFhir.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelFhir.myParameterNameHere header.
API: load-page
Both producer and consumer are supported
The load-page API is defined in the syntax as follows:
fhir:load-page/methodName?[parameters] The 3 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Loads the page of results at the given URL | ||
Loads the next page of results, using the next link of the given bundle | ||
Loads the previous page of results, using the previous link of the given bundle |
Method byUrl
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseBundle byUrl(String url, Class<org.hl7.fhir.instance.model.api.IBaseBundle> returnType, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/byUrl API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
returnType | The Bundle class of the FHIR version to return, such as org.hl7.fhir.r4.model.Bundle | Class |
url | The URL of the page to load, such as a next link of a Bundle | String |
Method next
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseBundle next(org.hl7.fhir.instance.model.api.IBaseBundle bundle, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/next API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
bundle | The Bundle of the current page | IBaseBundle |
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
Method previous
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseBundle previous(org.hl7.fhir.instance.model.api.IBaseBundle bundle, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/previous API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
bundle | The Bundle of the current page | IBaseBundle |
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
In addition to the parameters above, the fhir API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelFhir.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelFhir.myParameterNameHere header.
API: meta
Both producer and consumer are supported
The meta API is defined in the syntax as follows:
fhir:meta/methodName?[parameters] The 5 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Adds the tags, profiles and security labels of the given meta to the resource, without removing any | ||
Removes the tags, profiles and security labels of the given meta from the resource | ||
Fetches the tags, profiles and security labels of the given resource | ||
Fetches the tags, profiles and security labels used on the whole server | ||
Fetches the tags, profiles and security labels used by the resources of the given type |
Method add
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseMetaType add(org.hl7.fhir.instance.model.api.IBaseMetaType meta, org.hl7.fhir.instance.model.api.IIdType id, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/add API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
id | The ID of the resource, with its resource type, such as Patient/123 | IIdType |
meta | The meta with the tags, profiles and security labels to add | IBaseMetaType |
Method delete
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseMetaType delete(org.hl7.fhir.instance.model.api.IBaseMetaType meta, org.hl7.fhir.instance.model.api.IIdType id, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/delete API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
id | The ID of the resource, with its resource type, such as Patient/123 | IIdType |
meta | The meta with the tags, profiles and security labels to remove | IBaseMetaType |
Method getFromResource
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseMetaType getFromResource(Class<org.hl7.fhir.instance.model.api.IBaseMetaType> metaType, org.hl7.fhir.instance.model.api.IIdType id, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/getFromResource API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
id | The ID of the resource, with its resource type, such as Patient/123 | IIdType |
metaType | The Meta class of the FHIR version, such as org.hl7.fhir.r4.model.Meta | Class |
Method getFromServer
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseMetaType getFromServer(Class<org.hl7.fhir.instance.model.api.IBaseMetaType> metaType, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/getFromServer API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
metaType | The Meta class of the FHIR version, such as org.hl7.fhir.r4.model.Meta | Class |
Method getFromType
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseMetaType getFromType(Class<org.hl7.fhir.instance.model.api.IBaseMetaType> metaType, String resourceType, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/getFromType API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
metaType | The Meta class of the FHIR version, such as org.hl7.fhir.r4.model.Meta | Class |
resourceType | The resource type, such as Patient | String |
In addition to the parameters above, the fhir API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelFhir.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelFhir.myParameterNameHere header.
API: operation
Both producer and consumer are supported
The operation API is defined in the syntax as follows:
fhir:operation/methodName?[parameters] The 5 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Invokes the operation on the given resource | ||
Invokes the operation on the given version of a resource | ||
Invokes the operation on the whole server | ||
Invokes the operation on the given resource type | ||
Sends a message Bundle to the server with the $process-message operation |
Method onInstance
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseResource onInstance(org.hl7.fhir.instance.model.api.IIdType id, String name, org.hl7.fhir.instance.model.api.IBaseParameters parameters, Class<org.hl7.fhir.instance.model.api.IBaseParameters> outputParameterType, boolean useHttpGet, Class<org.hl7.fhir.instance.model.api.IBaseResource> returnType, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/onInstance API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
id | The ID of the resource, with its resource type, such as Patient/123 | IIdType |
name | The name of the operation, such as $everything (the $ is added when missing) | String |
outputParameterType | The Parameters class of the FHIR version, such as org.hl7.fhir.r4.model.Parameters, to invoke the operation without input parameters. When set, parameters is not used. May be null | Class |
parameters | The input parameters, as a Parameters resource of the FHIR version. Required unless outputParameterType is set | IBaseParameters |
returnType | The class of the resource that the operation returns, when it returns a resource other than Parameters, such as org.hl7.fhir.r4.model.Bundle for $everything. May be null | Class |
useHttpGet | Whether to invoke the operation with HTTP GET, with the parameters in the URL, rather than POST | Boolean |
Method onInstanceVersion
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseResource onInstanceVersion(org.hl7.fhir.instance.model.api.IIdType id, String name, org.hl7.fhir.instance.model.api.IBaseParameters parameters, Class<org.hl7.fhir.instance.model.api.IBaseParameters> outputParameterType, boolean useHttpGet, Class<org.hl7.fhir.instance.model.api.IBaseResource> returnType, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/onInstanceVersion API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
id | The ID of the resource, with its resource type and version, such as Patient/123/_history/2 | IIdType |
name | The name of the operation, such as $everything (the $ is added when missing) | String |
outputParameterType | The Parameters class of the FHIR version, such as org.hl7.fhir.r4.model.Parameters, to invoke the operation without input parameters. When set, parameters is not used. May be null | Class |
parameters | The input parameters, as a Parameters resource of the FHIR version. Required unless outputParameterType is set | IBaseParameters |
returnType | The class of the resource that the operation returns, when it returns a resource other than Parameters, such as org.hl7.fhir.r4.model.Bundle for $everything. May be null | Class |
useHttpGet | Whether to invoke the operation with HTTP GET, with the parameters in the URL, rather than POST | Boolean |
Method onServer
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseResource onServer(String name, org.hl7.fhir.instance.model.api.IBaseParameters parameters, Class<org.hl7.fhir.instance.model.api.IBaseParameters> outputParameterType, boolean useHttpGet, Class<org.hl7.fhir.instance.model.api.IBaseResource> returnType, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/onServer API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
name | The name of the operation, such as $everything (the $ is added when missing) | String |
outputParameterType | The Parameters class of the FHIR version, such as org.hl7.fhir.r4.model.Parameters, to invoke the operation without input parameters. When set, parameters is not used. May be null | Class |
parameters | The input parameters, as a Parameters resource of the FHIR version. Required unless outputParameterType is set | IBaseParameters |
returnType | The class of the resource that the operation returns, when it returns a resource other than Parameters, such as org.hl7.fhir.r4.model.Bundle for $everything. May be null | Class |
useHttpGet | Whether to invoke the operation with HTTP GET, with the parameters in the URL, rather than POST | Boolean |
Method onType
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseResource onType(Class<org.hl7.fhir.instance.model.api.IBaseResource> resourceType, String name, org.hl7.fhir.instance.model.api.IBaseParameters parameters, Class<org.hl7.fhir.instance.model.api.IBaseParameters> outputParameterType, boolean useHttpGet, Class<org.hl7.fhir.instance.model.api.IBaseResource> returnType, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/onType API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
name | The name of the operation, such as $everything (the $ is added when missing) | String |
outputParameterType | The Parameters class of the FHIR version, such as org.hl7.fhir.r4.model.Parameters, to invoke the operation without input parameters. When set, parameters is not used. May be null | Class |
parameters | The input parameters, as a Parameters resource of the FHIR version. Required unless outputParameterType is set | IBaseParameters |
resourceType | The resource type, as a class such as org.hl7.fhir.r4.model.Patient | Class |
returnType | The class of the resource that the operation returns, when it returns a resource other than Parameters, such as org.hl7.fhir.r4.model.Bundle for $everything. May be null | Class |
useHttpGet | Whether to invoke the operation with HTTP GET, with the parameters in the URL, rather than POST | Boolean |
Method processMessage
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseBundle processMessage(String respondToUri, org.hl7.fhir.instance.model.api.IBaseBundle msgBundle, boolean asynchronous, Class<org.hl7.fhir.instance.model.api.IBaseBundle> responseClass, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/processMessage API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
asynchronous | Whether to ask the server to process the message asynchronously (the async parameter), rather than synchronously | Boolean |
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
msgBundle | The message Bundle to send | IBaseBundle |
respondToUri | The URL that the server sends the response to, in the response-url parameter. May be null | String |
responseClass | The Bundle class of the FHIR version to return the response in, such as org.hl7.fhir.r4.model.Bundle | Class |
In addition to the parameters above, the fhir API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelFhir.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelFhir.myParameterNameHere header.
API: patch
Both producer and consumer are supported
The patch API is defined in the syntax as follows:
fhir:patch/methodName?[parameters] The 2 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Applies the patch to the resource with the given ID | ||
Applies the patch to the resource that matches the given search URL (a conditional patch) |
Method patchById
Signatures:
-
ca.uhn.fhir.rest.api.MethodOutcome patchById(String patchBody, String stringId, ca.uhn.fhir.rest.api.PreferReturnEnum preferReturn, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
-
ca.uhn.fhir.rest.api.MethodOutcome patchById(String patchBody, org.hl7.fhir.instance.model.api.IIdType id, ca.uhn.fhir.rest.api.PreferReturnEnum preferReturn, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/patchById API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
id | The ID of the resource, with its resource type, such as Patient/123 | IIdType |
patchBody | The patch document: a JSON Patch (RFC 6902) array or an XML Patch (RFC 5261) document; the type is detected from the text | String |
preferReturn | The value of the Prefer header, which asks the server what to return: REPRESENTATION (the resource, then available from MethodOutcome.getResource()), MINIMAL (nothing) or OPERATION_OUTCOME (an OperationOutcome), or null to send no Prefer header | PreferReturnEnum |
stringId | The ID of the resource, with its resource type, such as Patient/123 | String |
Method patchByUrl
Signatures:
-
ca.uhn.fhir.rest.api.MethodOutcome patchByUrl(String patchBody, String url, ca.uhn.fhir.rest.api.PreferReturnEnum preferReturn, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/patchByUrl API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
patchBody | The patch document: a JSON Patch (RFC 6902) array or an XML Patch (RFC 5261) document; the type is detected from the text | String |
preferReturn | The value of the Prefer header, which asks the server what to return: REPRESENTATION (the resource, then available from MethodOutcome.getResource()), MINIMAL (nothing) or OPERATION_OUTCOME (an OperationOutcome), or null to send no Prefer header | PreferReturnEnum |
url | The search URL of the resource to patch, of the form [ResourceType]?[Parameters], such as Patient?identifier=123 | String |
In addition to the parameters above, the fhir API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelFhir.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelFhir.myParameterNameHere header.
API: read
Both producer and consumer are supported
The read API is defined in the syntax as follows:
fhir:read/methodName?[parameters] The 2 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Reads the resource with the given ID | ||
Reads the resource at the given absolute URL |
Method resourceById
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseResource resourceById(Class<org.hl7.fhir.instance.model.api.IBaseResource> resource, Long longId, String ifVersionMatches, Boolean returnNull, org.hl7.fhir.instance.model.api.IBaseResource returnResource, Boolean throwError, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
-
org.hl7.fhir.instance.model.api.IBaseResource resourceById(Class<org.hl7.fhir.instance.model.api.IBaseResource> resource, String stringId, String version, String ifVersionMatches, Boolean returnNull, org.hl7.fhir.instance.model.api.IBaseResource returnResource, Boolean throwError, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
-
org.hl7.fhir.instance.model.api.IBaseResource resourceById(Class<org.hl7.fhir.instance.model.api.IBaseResource> resource, org.hl7.fhir.instance.model.api.IIdType id, String ifVersionMatches, Boolean returnNull, org.hl7.fhir.instance.model.api.IBaseResource returnResource, Boolean throwError, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
-
org.hl7.fhir.instance.model.api.IBaseResource resourceById(String resourceClass, Long longId, String ifVersionMatches, Boolean returnNull, org.hl7.fhir.instance.model.api.IBaseResource returnResource, Boolean throwError, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
-
org.hl7.fhir.instance.model.api.IBaseResource resourceById(String resourceClass, String stringId, String ifVersionMatches, String version, Boolean returnNull, org.hl7.fhir.instance.model.api.IBaseResource returnResource, Boolean throwError, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
-
org.hl7.fhir.instance.model.api.IBaseResource resourceById(String resourceClass, org.hl7.fhir.instance.model.api.IIdType id, String ifVersionMatches, Boolean returnNull, org.hl7.fhir.instance.model.api.IBaseResource returnResource, Boolean throwError, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/resourceById API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
id | The ID of the resource, such as Patient/123 | IIdType |
ifVersionMatches | The version to send in an If-None-Match header. When it is the newest version on the server, the server answers 304 Not Modified and the result depends on returnNull, returnResource and throwError; when none of them is set, ifVersionMatches is ignored. May be null | String |
longId | The ID of the resource, as a number | Long |
resource | The resource type to read, as a class such as org.hl7.fhir.r4.model.Patient | Class |
resourceClass | The name of the resource type to read, such as Patient | String |
returnNull | True to return null when ifVersionMatches matches | Boolean |
returnResource | The resource to return when ifVersionMatches matches | IBaseResource |
stringId | The ID of the resource, such as 123 | String |
throwError | True to throw a NotModifiedException when ifVersionMatches matches | Boolean |
version | The version of the resource to read, or null to read the newest version | String |
Method resourceByUrl
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseResource resourceByUrl(Class<org.hl7.fhir.instance.model.api.IBaseResource> resource, String url, String ifVersionMatches, Boolean returnNull, org.hl7.fhir.instance.model.api.IBaseResource returnResource, Boolean throwError, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
-
org.hl7.fhir.instance.model.api.IBaseResource resourceByUrl(Class<org.hl7.fhir.instance.model.api.IBaseResource> resource, org.hl7.fhir.instance.model.api.IIdType iUrl, String ifVersionMatches, Boolean returnNull, org.hl7.fhir.instance.model.api.IBaseResource returnResource, Boolean throwError, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
-
org.hl7.fhir.instance.model.api.IBaseResource resourceByUrl(String resourceClass, String url, String ifVersionMatches, Boolean returnNull, org.hl7.fhir.instance.model.api.IBaseResource returnResource, Boolean throwError, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
-
org.hl7.fhir.instance.model.api.IBaseResource resourceByUrl(String resourceClass, org.hl7.fhir.instance.model.api.IIdType iUrl, String ifVersionMatches, Boolean returnNull, org.hl7.fhir.instance.model.api.IBaseResource returnResource, Boolean throwError, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/resourceByUrl API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
iUrl | The absolute URL of the resource, such as http://example.com/fhir/Patient/123, as an IIdType | IIdType |
ifVersionMatches | The version to send in an If-None-Match header. When it is the newest version on the server, the server answers 304 Not Modified and the result depends on returnNull, returnResource and throwError; when none of them is set, ifVersionMatches is ignored. May be null | String |
resource | The resource type to read, as a class such as org.hl7.fhir.r4.model.Patient | Class |
resourceClass | The name of the resource type to read, such as Patient | String |
returnNull | True to return null when ifVersionMatches matches | Boolean |
returnResource | The resource to return when ifVersionMatches matches | IBaseResource |
throwError | True to throw a NotModifiedException when ifVersionMatches matches | Boolean |
url | The absolute URL of the resource, such as http://example.com/fhir/Patient/123 | String |
In addition to the parameters above, the fhir API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelFhir.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelFhir.myParameterNameHere header.
API: search
Both producer and consumer are supported
The search API is defined in the syntax as follows:
fhir:search/methodName?[parameters] The 2 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Searches for the resources of the given type that match the given search parameters | ||
Searches with the given search URL |
Method searchByResource
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseBundle searchByResource(String resourceName, java.util.Map<String, java.util.List<String>> searchParameters, ca.uhn.fhir.rest.api.SearchStyleEnum searchStyle, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/searchByResource API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
resourceName | The resource type to search for, such as Patient | String |
searchParameters | The search parameters, as a map from the name of a parameter to its values, such as family to Simpson, or null for none | Map |
searchStyle | How the search is sent: GET (the parameters in the URL), GET_WITH_SEARCH (a GET to [type]/_search) or POST (a POST to [type]/_search with the parameters in the body). Null means POST | SearchStyleEnum |
Method searchByUrl
Signatures:
-
org.hl7.fhir.instance.model.api.IBaseBundle searchByUrl(String url, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/searchByUrl API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
url | The URL to search for. Note that this URL may be complete (e.g. http://example.com/base/Patient?name=foo) in which case the client’s base URL will be ignored. Or it can be relative (e.g. Patient?name=foo) in which case the client’s base URL will be used. | String |
In addition to the parameters above, the fhir API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelFhir.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelFhir.myParameterNameHere header.
API: transaction
Both producer and consumer are supported
The transaction API is defined in the syntax as follows:
fhir:transaction/methodName?[parameters] The 2 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Sends the given transaction Bundle | ||
Sends the given resources as a transaction |
Method withBundle
Signatures:
-
String withBundle(String stringBundle, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
-
org.hl7.fhir.instance.model.api.IBaseBundle withBundle(org.hl7.fhir.instance.model.api.IBaseBundle bundle, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/withBundle API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
bundle | The transaction Bundle to send | IBaseBundle |
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
stringBundle | The transaction Bundle to send, as JSON or XML text. The response is then returned as text | String |
Method withResources
Signatures:
-
java.util.List<org.hl7.fhir.instance.model.api.IBaseResource> withResources(java.util.List<org.hl7.fhir.instance.model.api.IBaseResource> resources, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/withResources API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
resources | The resources of the transaction | List |
In addition to the parameters above, the fhir API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelFhir.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelFhir.myParameterNameHere header.
API: update
Both producer and consumer are supported
The update API is defined in the syntax as follows:
fhir:update/methodName?[parameters] The 2 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Updates the resource with the given ID, or with the ID of the resource when no ID is given | ||
Updates the resource that matches the given search URL (a conditional update) |
Method resource
Signatures:
-
ca.uhn.fhir.rest.api.MethodOutcome resource(String resourceAsString, String stringId, ca.uhn.fhir.rest.api.PreferReturnEnum preferReturn, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
-
ca.uhn.fhir.rest.api.MethodOutcome resource(String resourceAsString, org.hl7.fhir.instance.model.api.IIdType id, ca.uhn.fhir.rest.api.PreferReturnEnum preferReturn, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
-
ca.uhn.fhir.rest.api.MethodOutcome resource(org.hl7.fhir.instance.model.api.IBaseResource resource, String stringId, ca.uhn.fhir.rest.api.PreferReturnEnum preferReturn, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
-
ca.uhn.fhir.rest.api.MethodOutcome resource(org.hl7.fhir.instance.model.api.IBaseResource resource, org.hl7.fhir.instance.model.api.IIdType id, ca.uhn.fhir.rest.api.PreferReturnEnum preferReturn, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/resource API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
id | The ID of the resource to update, such as Patient/123, or null to use the ID of the resource | IIdType |
preferReturn | The value of the Prefer header, which asks the server what to return: REPRESENTATION (the resource, then available from MethodOutcome.getResource()), MINIMAL (nothing) or OPERATION_OUTCOME (an OperationOutcome), or null to send no Prefer header | PreferReturnEnum |
resource | The resource to update | IBaseResource |
resourceAsString | The resource to update, as JSON or XML text | String |
stringId | The ID of the resource to update, such as Patient/123, or null to use the ID of the resource | String |
Method resourceBySearchUrl
Signatures:
-
ca.uhn.fhir.rest.api.MethodOutcome resourceBySearchUrl(String resourceAsString, String url, ca.uhn.fhir.rest.api.PreferReturnEnum preferReturn, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
-
ca.uhn.fhir.rest.api.MethodOutcome resourceBySearchUrl(org.hl7.fhir.instance.model.api.IBaseResource resource, String url, ca.uhn.fhir.rest.api.PreferReturnEnum preferReturn, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/resourceBySearchUrl API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
preferReturn | The value of the Prefer header, which asks the server what to return: REPRESENTATION (the resource, then available from MethodOutcome.getResource()), MINIMAL (nothing) or OPERATION_OUTCOME (an OperationOutcome), or null to send no Prefer header | PreferReturnEnum |
resource | The resource to update | IBaseResource |
resourceAsString | The resource to update, as JSON or XML text | String |
url | The search URL of the resource to update, of the form [ResourceType]?[Parameters], such as Patient?identifier=123 | String |
In addition to the parameters above, the fhir API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelFhir.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelFhir.myParameterNameHere header.
API: validate
Both producer and consumer are supported
The validate API is defined in the syntax as follows:
fhir:validate/methodName?[parameters] The 1 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Validates the resource with the $validate operation of the server |
Method resource
Signatures:
-
ca.uhn.fhir.rest.api.MethodOutcome resource(String resourceAsString, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
-
ca.uhn.fhir.rest.api.MethodOutcome resource(org.hl7.fhir.instance.model.api.IBaseResource resource, java.util.Map<org.apache.camel.component.fhir.api.ExtraParameters, Object> extraParameters);
The fhir/resource API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
extraParameters | Extra settings of the request, as a map from ExtraParameters to their values: encodeJson, encodeXml, cacheControlDirective, subsetElements, encodingEnum, preferredResponseType, preferredResponseTypes, prettyPrint and summaryEnum. A producer also takes each of them from a header named CamelFhir. followed by its name, such as CamelFhir.encodeJson. May be null | Map |
resource | The resource to validate | IBaseResource |
resourceAsString | The resource to validate, as JSON or XML text | String |
In addition to the parameters above, the fhir API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelFhir.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelFhir.myParameterNameHere header.
Message Body
The message body at each side of the FHIR component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.
| Side | Body | Description |
|---|---|---|
Consumer |
| One message per poll with the return value of the method: a MethodOutcome for create, update, patch, delete and validate, and a HAPI FHIR model object of the fhirVersion for the others, such as the Bundle of a search. A List is split into one message per resource, and transaction withBundle with stringBundle gives the response as text.
|
Producer input |
| The body is used only when inBody names the argument of the method it is, and then converted to the type of that argument: resourceAsString, stringBundle and url take text, which a byte array, a stream or a file converts to, and resource, bundle and resources a HAPI FHIR object or a List of them (unmarshal with fhirJson or fhirXml first). A body that cannot be converted fails the exchange before the call. Without inBody the arguments come from the options and the CamelFhir. headers. Not known when |
Producer output |
| The return value of the method: a MethodOutcome for create, update, patch, delete and validate, and a HAPI FHIR model object of the fhirVersion for the others, such as the Bundle of a search or the resource of a read; marshal a resource or a Bundle with fhirJson or fhirXml to get text. transaction gives a Bundle for withBundle with bundle, the response as text with stringBundle, and a List of the resources for withResources.
|
The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.
| This is an API-based component, so per-call parameters can be supplied through |
Usage
The URI names the API and its method, such as fhir://read/resourceById. The parameters of the method are endpoint options, or headers that start with CamelFhir., such as CamelFhir.stringId. The routes below create a patient from JSON, read a patient by its id, and search patients by family name:
- route:
from:
uri: direct:createPatient
steps:
- to:
uri: fhir://create/resource
parameters:
serverUrl: http://localhost:8080/fhir
fhirVersion: R4
inBody: resourceAsString
- log:
message: "Created ${body.id.value}"
- route:
from:
uri: direct:readPatient
steps:
- setHeader:
name: CamelFhir.stringId
expression:
simple:
expression: "${body}"
- to:
uri: fhir://read/resourceById
parameters:
serverUrl: http://localhost:8080/fhir
fhirVersion: R4
resourceClass: Patient
- marshal:
fhirJson:
fhirVersion: R4
- log:
message: "${body}"
- route:
from:
uri: direct:searchPatients
steps:
- to:
uri: fhir://search/searchByUrl
parameters:
serverUrl: http://localhost:8080/fhir
fhirVersion: R4
url: "Patient?family=Simpson"
- log:
message: "Found ${body.total} patients" The inBody option names the parameter of the method that the message body is, such as resourceAsString in the first route. The body is converted to the type of that parameter, so a byte array, a stream or a file works for a parameter of type String. A body that cannot be converted fails the exchange before the call, with an error that names the parameter. Without inBody the body is not used.
After the call the message body is the result of the method: a MethodOutcome for create, update, patch, delete and validate, and a HAPI FHIR model object for the others, such as the Bundle of a search or the resource of a read. Marshal a resource or a Bundle with fhirJson or fhirXml to get text.