REST Postman

To call and expose REST services using a Postman Collection as contract.

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 33 options, which are listed below.

Name Description Default Type

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

Sets the context-path to use for servicing the Postman collection document. The document is served with all auth blocks and all secret variables removed.

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

API basePath, for example /v2. Default is unset, if set overrides the value derived from the request URL in the collection.

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 to enable validation of the client request. A Postman collection has no schemas, so this is a best-effort check of required headers, query parameters and body presence only.

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 a loaded collection is cached, in milliseconds. Use -1 to cache for the lifetime of the component.

-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:), 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 will perform the requests. The component must be present in Camel registry and it must implement RestProducerFactory service provider interface. If not set CLASSPATH is searched for single component that implements RestProducerFactory SPI.

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 will service the requests. The component must be present in Camel registry and it must be able to service contract-first REST consumers, as platform-http does. If not set CLASSPATH is searched for a single component with that capability.

String

camel.component.rest-postman.consumes

What payload type this component is capable of consuming. This equates to the value of the Accept HTTP header. A Postman collection does not describe responses, so unlike an OpenAPI specification there is nothing to infer this from and it is unset by default.

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 if a \{{variable}} placeholder used by the selected request cannot be resolved. When false the placeholder is left as-is.

false

Boolean

camel.component.rest-postman.host

Scheme hostname and port to direct the HTTP requests to in the form of https://hostname:port. If set overrides any value derived from the collection.

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

Whether the consumer should fail, ignore or return a mock response for requests in the collection that are not mapped to a corresponding route.

fail

String

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

Used for inclusive filtering of mock data from directories. The pattern is using Ant-path style pattern. Multiple patterns can be specified separated by comma. Saved example responses in the collection are preferred over these files.

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.

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

What payload type this component is producing. This equates to the value of the Content-Type HTTP header. If not set it is inferred from the body mode of the request in the collection.

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, as comma separated Ant-style patterns matched against the folder qualified request id. Prefix a pattern with ! to exclude.

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.rest-postman-processor-strategy

To use a custom strategy for how to service the requests of the collection. 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

Customize TLS parameters used by the component. If not set defaults to the TLS parameters set in the Camel context. These parameters are used both when fetching a collection from the Postman cloud and by the delegate producer. The option is a org.apache.camel.support.jsse.SSLContextParameters type.

SSLContextParameters

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

Enable usage of global SSL context parameters.

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>