REST API

Since Camel 2.16

The rest-api component is used for providing Swagger API of the REST services which has been defined using the rest-dsl in Camel.

URI Options

The REST API component has no options.

The REST API endpoint is configured using URI syntax:

rest-api:path/contextIdPattern

with the following path and query parameters:

Path Parameters (2 parameters):

Name Description Default Type

path

Required The base path

String

contextIdPattern

Optional CamelContext id pattern to only allow Rest APIs from rest services within CamelContext’s which name matches the pattern.

String

Query Parameters (6 parameters):

Name Description Default Type

apiComponentName (consumer)

The Camel Rest API component to use for generating the API of the REST services, such as swagger.

String

bridgeErrorHandler (consumer)

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN/ERROR level and ignored.

false

boolean

componentName (consumer)

The Camel Rest component to use for the REST transport, such as restlet, spark-rest. If no component has been explicit configured, then Camel will lookup if there is a Camel component that integrates with the Rest DSL, or if a org.apache.camel.spi.RestConsumerFactory is registered in the registry. If either one is found, then that is being used.

String

exceptionHandler (consumer)

To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions, that will be logged at WARN/ERROR level and ignored.

ExceptionHandler

exchangePattern (consumer)

Sets the default exchange pattern when creating an exchange.

ExchangePattern

synchronous (advanced)

Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported).

false

boolean

See Also

  • Rest DSL

  • Swagger Java