Chapter 277. URI format

rest-openapi:[specificationPath#]operationId

Where operationId is the ID of the operation in the OpenApi specification, and specificationPath is the path to the specification. If the specificationPath is not specified it defaults to openapi.json. The lookup mechanism uses Camels ResourceHelper to load the resource, which means that you can use CLASSPATH resources (classpath:my-specification.json), files (file:/some/path.json), the web (http://api.example.com/openapi.json) or reference a bean (ref:nameOfBean) or use a method of a bean (bean:nameOfBean.methodName) to get the specification resource, failing that OpenApi’s own resource loading support.

This component does not act as a HTTP client, it delegates that to another component mentioned above. The lookup mechanism searches for a single component that implements the RestProducerFactory interface and uses that. If the CLASSPATH contains more than one, then the property componentName should be set to indicate which component to delegate to.

Most of the configuration is taken from the OpenApi specification but the option exists to override those by specifying them on the component or on the endpoint. Typically you would just need to override the host or basePath if those differ from the specification.

Note

The host parameter should contain the absolute URI containing scheme, hostname and port number, for instance: https://api.example.com

With componentName you specify what component is used to perform the requests, this named component needs to be present in the Camel context and implement the required RestProducerFactory interface — as do the components listed at the top.

If you do not specify the componentName at either component or endpoint level, CLASSPATH is searched for a suitable delegate. There should be only one component present on the CLASSPATH that implements the RestProducerFactory interface for this to work.

This component’s endpoint URI is lenient which means that in addition to message headers you can specify REST operation’s parameters as endpoint parameters, these will be constant for all subsequent invocations so it makes sense to use this feature only for parameters that are indeed constant for all invocations — for example API version in path such as /api/{version}/users/{id}.