Camel Spring Boot

REST Postman

Call the REST APIs described by a Postman Collection, or serve its requests as a contract-first REST service.

What’s inside

Please refer to the above links for usage and configuration details.

Maven coordinates

<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-rest-postman-starter</artifactId>
</dependency>

Spring Boot Auto-Configuration

The starter supports 34 options, which are listed below.

Name Description Default Type

camel.component.rest-postman.api-context-path

The path, below the base path, on which the consumer serves the collection document as JSON, for example /postman.json. The auth blocks are removed from the document and the values of secret variables are replaced. If not set, the document is not served.

String

camel.component.rest-postman.autowired-enabled

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

camel.component.rest-postman.base-path

The base path of the API, for example /v2, in front of the path of every request, and the path the consumer serves the requests under. If not set, the context path of the REST configuration is used, or else the path that the host of the request URL carries, such as /v1 when \{{baseUrl}} is https://api.example.com/v1.

String

camel.component.rest-postman.bridge-error-handler

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

camel.component.rest-postman.client-request-validation

Whether the consumer validates the incoming requests. A Postman collection has no schemas, so this is a best-effort check: the headers the request declares, the query parameters that have a value in the collection, a body when the collection has one, and the media types. It is also enabled by clientRequestValidation of the REST configuration.

false

Boolean

camel.component.rest-postman.collection-auth

What to do with the auth block the collection declares for the target API. With ignore the block is not applied, and a warning names the type that was found. With header the basic, bearer and apikey types are applied as a static header or query parameter, and any other type fails at startup rather than silently sending no credential. With fail any auth block other than noauth is rejected.

ignore

String

camel.component.rest-postman.collection-cache-ttl

How long, in milliseconds, a loaded collection stays in the cache of the component, so that endpoints over the same collection load it once. A negative value keeps it until the component stops. The collection is read when a producer or consumer is created, so a running endpoint does not pick up changes.

-1

Long

camel.component.rest-postman.collection-source

The Postman Collection to use, when it is not given on the endpoint. Either a resource URI of a Collection v2.1 JSON document (classpath:, file: or http:), where a name without a scheme is loaded from the classpath, or the uid of a collection to fetch from the Postman cloud.

String

camel.component.rest-postman.collection-source-type

How to interpret collectionSource. With auto, a bare collection UUID or {ownerId}-{uuid} is fetched from the Postman cloud and anything else is resolved as a resource (classpath:, file:, http:). Use resource or cloud to decide explicitly.

auto

String

camel.component.rest-postman.component-name

Name of the Camel component that performs the HTTP requests, which must implement the RestProducerFactory SPI, as http, vertx-http, undertow and netty-http do. If not set, a component with that capability already in the Camel context or the registry is used, or else the first of http, vertx-http, undertow and netty-http on the classpath.

String

camel.component.rest-postman.configuration

The shared configuration used as the template for every endpoint created by this component. The option is a org.apache.camel.component.rest.postman.RestPostmanConfiguration type.

RestPostmanConfiguration

camel.component.rest-postman.connect-timeout

Connection timeout in milliseconds when fetching a collection from the Postman cloud.

15000

Long

camel.component.rest-postman.consumer-component-name

Name of the Camel component that serves the HTTP requests, which must implement the RestOpenApiConsumerFactory SPI, as platform-http does. If not set, a component with that capability already in the Camel context is used, or else platform-http.

String

camel.component.rest-postman.consumes

The media type accepted in the response, sent as the Accept HTTP header. If not set, the Accept header of the request in the collection is used, when it has one. A Postman collection does not describe responses, so there is nothing else to infer it from.

String

camel.component.rest-postman.enabled

Whether to enable auto configuration of the rest-postman component. This is enabled by default.

Boolean

camel.component.rest-postman.fail-on-unresolved-variable

Whether to fail when a \{{variable}} placeholder used by a selected request cannot be resolved. When false the placeholder is left as-is in headers and bodies, while one left in the URL, the query parameters, Accept or Content-Type fails anyway.

false

Boolean

camel.component.rest-postman.host

The scheme, host name and port to send the requests to, in the form http[s]://hostname[:port]. If set, it replaces the host of every request URL in the collection. If not set, the host comes from the request URL, then from the REST configuration, and for a collection loaded over HTTP from the address it was loaded from.

String

camel.component.rest-postman.lazy-start-producer

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

camel.component.rest-postman.missing-request

What the consumer does with a request of the collection that has no route consuming from the direct endpoint named after the request id, such as direct:getUserById. With fail the route does not start, with ignore a warning is logged and such a request goes on to the route of this endpoint as is, and with mock it is answered with a saved example response of the collection, or else a file found by mockIncludePattern. If not set, it is mock when the Camel profile is dev, and fail otherwise.

fail

String

camel.component.rest-postman.mock-include-pattern

Comma separated Ant-style patterns of the files that missingRequest=mock answers from, for a request without a saved example response in the collection. A file is used when its path without the extension ends with the request path, such as camel-mock/pets/1.json for GET /pets/1.

classpath:camel-mock/**

String

camel.component.rest-postman.oauth-profile

The OAuth profile to use for authenticating the incoming requests. The profile is enforced by the consumer component servicing the requests, and the route fails to start when that component cannot enforce one.

String

camel.component.rest-postman.postman-api-key

The Postman API key used to fetch the collection from the Postman cloud. This credential authenticates against Postman itself and is never sent to the API the collection describes.

String

camel.component.rest-postman.postman-api-key-header

The HTTP header used to send the Postman API key when fetching a collection.

X-Api-Key

String

camel.component.rest-postman.postman-api-url

The base URL of the Postman API used to fetch collections. Must use https, except for localhost, because plain http would send the Postman API key in clear text.

https://api.getpostman.com

String

camel.component.rest-postman.produces

The media type of the request body, sent as the Content-Type HTTP header. If not set, the Content-Type header of the request in the collection is used, or else a type inferred from its body mode, such as application/json for a raw JSON body.

String

camel.component.rest-postman.query-parameter-mode

How to treat the query parameters declared in the collection. With placeholder the parameter names are bound to message headers and the values in the collection are ignored as sample data. With literal the values in the collection are sent as-is.

placeholder

String

camel.component.rest-postman.request-filter

Filters which requests of the collection are used, by the consumer and the producer, as comma separated Ant-style patterns matched against the folder qualified slug of the request, such as users/getUserById. Prefix a pattern with ! to exclude; with only exclusions, every other request is kept.

String

camel.component.rest-postman.request-timeout

Request timeout in milliseconds when fetching a collection from the Postman cloud.

30000

Long

camel.component.rest-postman.resolve-variables-from-properties

Whether a \{{variable}} placeholder that neither the collection nor the variables option defines is resolved from Camel properties, which by default also cover JVM system properties and OS environment variables. With auto, this is done for a collection read from the classpath or the file system, and not for one fetched from the Postman cloud, over HTTP or through any other resource scheme, because whoever edits or serves such a collection could otherwise copy those values into an outgoing request. Use enabled or disabled to decide explicitly for any source.

auto

String

camel.component.rest-postman.rest-postman-processor-strategy

A custom strategy for how the consumer services the requests of the collection: which route each request is dispatched to, the mock responses and the collection document. The default strategy dispatches each request to the direct endpoint named after the request id, such as direct:getUserById. The option is a org.apache.camel.component.rest.postman.RestPostmanProcessorStrategy type.

RestPostmanProcessorStrategy

camel.component.rest-postman.run-fail-fast

When the endpoint runs more than one request, that is when it selects a folder or the whole collection, whether to stop and fail on the first request that fails. When false every request is attempted and the failure is recorded in its result.

true

Boolean

camel.component.rest-postman.ssl-context-parameters

The TLS configuration used when fetching a collection from the Postman cloud, and set on the component that performs the requests when this endpoint creates it, as one already in the Camel context is not changed. If not set, see useGlobalSslContextParameters. The option is a org.apache.camel.support.jsse.SSLContextParameters type.

SSLContextParameters

camel.component.rest-postman.use-global-ssl-context-parameters

Whether to use the global SSL context parameters of the Camel context when sslContextParameters is not set, when fetching a collection from the Postman cloud and for the component that performs the requests when this endpoint creates it.

false

Boolean

camel.component.rest-postman.variables

Values for the \{{variable}} placeholders used in the collection. These override the variables declared by the collection and its folders. This is a multi-value option with prefix: variable.

Object>