Methods

Methods

Complete reference for all HTTP methods supported by the pfx-rest component, the full URI parameter list, and usage examples.


HTTP Methods

GET

Standard HTTP GET for retrieving resources.

XML
<route id="restGet">
    <from uri="direct:fetchData"/>
    <to uri="pfx-rest:get?connection=myRestConn&amp;uri=/api/v1/products"/>
</route>

POST

HTTP POST for creating resources. The exchange body is sent as the request body.

XML
<route id="restPost">
    <from uri="direct:sendData"/>
    <to uri="pfx-rest:post?connection=myRestConn&amp;uri=/api/v1/orders&amp;contentType=application/json"/>
</route>

PUT

HTTP PUT for replacing resources. The exchange body is sent as the request body.

XML
<route id="restPut">
    <from uri="direct:updateData"/>
    <to uri="pfx-rest:put?connection=myRestConn&amp;uri=/api/v1/orders/123"/>
</route>

PATCH

HTTP PATCH for partial updates. The exchange body is sent as the request body.

XML
<route id="restPatch">
    <from uri="direct:patchData"/>
    <to uri="pfx-rest:patch?connection=myRestConn&amp;uri=/api/v1/orders/123"/>
</route>

DELETE

HTTP DELETE for removing resources.

XML
<route id="restDelete">
    <from uri="direct:deleteData"/>
    <to uri="pfx-rest:delete?connection=myRestConn&amp;uri=/api/v1/orders/123"/>
</route>

HTTP HEAD for retrieving response headers without a body.

XML
<route id="restHead">
    <from uri="direct:checkResource"/>
    <to uri="pfx-rest:head?connection=myRestConn&amp;uri=/api/v1/products/123"/>
</route>

OPTIONS

HTTP OPTIONS for discovering allowed methods and CORS preflight.

XML
<route id="restOptions">
    <from uri="direct:checkOptions"/>
    <to uri="pfx-rest:options?connection=myRestConn&amp;uri=/api/v1/products"/>
</route>

TRACE

HTTP TRACE for diagnostic/debugging purposes.

XML
<route id="restTrace">
    <from uri="direct:trace"/>
    <to uri="pfx-rest:trace?connection=myRestConn&amp;uri=/api/v1/debug"/>
</route>

system

Special method that reads configuration from system properties rather than inline parameters. Used for system-configuration-driven REST calls.

XML
<route id="restSystem">
    <from uri="direct:systemCall"/>
    <to uri="pfx-rest:system?systemName=externalERP&amp;systemConfigurationItem=fetchOrders"/>
</route>

URI Parameters

The URI parameters below configure a single pfx-rest:method endpoint. The HTTP transport options (Timeouts, Connection Pooling and Keep-Alive, Proxy) are also configurable as process-wide defaults via integration.pfx-rest.* properties in application.properties. A URI parameter overrides the matching default for that one endpoint; if you don't set it, the global default applies.

Applicability — these parameters configure the pfx-rest Camel component, which is used to call non-PriceFx REST APIs (SAP, Salesforce, custom HTTP services, etc.). They do not affect PriceFx partition calls — those go through the pfx-api component, which uses the pricefx-client library and is tuned by a separate integration.pfx.* namespace.

Core Parameters

Parameter

Type

Default

Description

method

String

(required, path)

HTTP method to use (get, post, put, delete, patch, head, options, trace, system)

uri

String


URI to invoke. If the connection does not specify a URL, provide the full path to the resource.

connection

String


Name of the connection to use for authentication and base URL resolution

contentType

String

application/json

Content type of the request

okStatusCodeRange

String

200-299

HTTP status codes considered a successful response

mapper

String


Mapper to apply to request/response

filter

String


Filter to apply

Input/Output Routing

Parameter

Type

Default

Description

inputSource

String


Source of data in the exchange: header, property, or body

inputSourceName

String


Name of the header or property when inputSource is header or property

outputTarget

String


Target for response data: header, property, or body

outputTargetName

String


Name of the header or property when outputTarget is header or property

Example -- read input from header, write output to header:

XML
<route id="restInputOutput">
    <from uri="direct:start"/>
    <setHeader name="requestPayload">
        <constant>{"key": "value"}</constant>
    </setHeader>
    <to uri="pfx-rest:post?connection=myRestConn&amp;uri=/api/v1/data&amp;inputSource=header&amp;inputSourceName=requestPayload&amp;outputTarget=header&amp;outputTargetName=responseData"/>
</route>

Proxy

Parameter

Type

Default

Description

proxyHost

String


Proxy host. Must be set together with proxyPort. Global default: integration.pfx-rest.proxy-host.

proxyPort

Integer


Proxy port. Must be set together with proxyHost. Global default: integration.pfx-rest.proxy-port.

Timeouts

Parameter

Type

Default

Description

connectionTimeoutMs

Long

20000

Legacy connection timeout (ms). Kept for backwards compatibility — prefer connectTimeoutMs. Used both for the authentication request and the fetch. Global default: integration.pfx-rest.connection-timeout-ms.

connectTimeoutMs

Long

20000

Time (ms) to establish the TCP connection to the target host (fires before the request is sent). Global default: integration.pfx-rest.connect-timeout-ms.

soTimeoutMs

Long

3600000

Socket read timeout (ms) once the response body is streaming. Higher than responseTimeoutMs because slow downloads can be normal. Global default: integration.pfx-rest.so-timeout-ms.

responseTimeoutMs

Long

20000

Time (ms) the client waits for the response headers after the request is sent. Global default: integration.pfx-rest.response-timeout-ms.

Connection Pooling and Keep-Alive

Parameter

Type

Default

Description

reuseConnection

Boolean

true

Reuse pooled keep-alive connections across requests to the same target. Set to false to open a fresh connection per request. Global default: integration.pfx-rest.reuse-connections.

evictExpiredConnections

Boolean

true

Run a background evictor that removes pooled connections that exceeded their keep-alive lifetime. Global default: integration.pfx-rest.evict-expired-connections.

evictIdleConnections

Boolean

true

Run a background evictor for connections idle longer than evictIdleConnectionsMaxIdleTimeMs. Independent from evictExpiredConnections. Global default: integration.pfx-rest.evict-idle-connections.

evictIdleConnectionsMaxIdleTimeMs

Long

30000

Idle timeout (ms) used by evictIdleConnections to close idle connections. Global default: integration.pfx-rest.evict-idle-connections-max-idle-time-ms.

maxConnectionsTotal

Integer

200

Maximum total HTTP connections kept in the pool across all routes. Global default: integration.pfx-rest.max-connections-total.

maxConnectionsPerRoute

Integer

100

Maximum concurrent HTTP connections per target route (host/port pair). Global default: integration.pfx-rest.max-connections-per-route.

soKeepAlive

Boolean

true

Enable the SO_KEEPALIVE socket option so the OS pings idle TCP connections to detect half-closed peers. Global default: integration.pfx-rest.so-keep-alive.

useMinimalKeepAliveStrategy

Boolean

false

When true, ignore server-advertised Keep-Alive and use a minimal duration. Useful behind load balancers that close idle connections aggressively; effectively disables connection reuse. Global default: integration.pfx-rest.use-minimal-keep-alive-strategy.

Streaming and File Upload

Parameter

Type

Default

Description

disableStreamCache

boolean

false

When true, content is streamed directly to file instead of stored in memory

downloadDir

String


Custom directory for downloaded files when disableStreamCache is enabled (defaults to temp dir)

autoDecode

boolean

true

Whether to auto-decode response content

fileKey

String

file

Key name for the file part in multipart uploads

useBoundary

boolean

true

Whether to use a boundary in multipart requests and content type

maxResponseSizeInMB

int

0 (unlimited)

Maximum response size in MB. Throws an exception if exceeded.

Example -- download large file with streaming:

XML
<route id="restDownload">
    <from uri="direct:downloadFile"/>
    <to uri="pfx-rest:get?connection=myRestConn&amp;uri=/api/v1/export&amp;disableStreamCache=true&amp;downloadDir=/tmp/downloads"/>
</route>

Example -- response size limit:

XML
<to uri="pfx-rest:get?connection=myRestConn&amp;uri=/api/v1/large-data&amp;maxResponseSizeInMB=50"/>

An exception is thrown if the response exceeds 50 MB.

Connection Behavior

Parameter

Type

Default

Description

failIfNoConnection

boolean

false

Whether to fail when a named connection is not found, or fall back to default behavior

System Configuration (method=system)

Parameter

Type

Description

systemName

String

System name

systemConfigurationItem

String

System configuration item

systemConfigurationProperties

Map

Additional system configuration properties (unmatched URI parameters are collected here)

Query Parameters

Unmatched URI parameters (those not recognized as component options) are automatically collected as query parameters and appended to the request URL:

XML
<route id="restGetWithParams">
    <from uri="direct:search"/>
    <to uri="pfx-rest:get?connection=myRestConn&amp;uri=/api/v1/search&amp;q=test&amp;limit=100"/>
</route>

Here, q and limit are passed as query parameters: /api/v1/search?q=test&limit=100.

Error Handling

  • HTTP responses outside the okStatusCodeRange result in an ExternalSystemException.

  • If failIfNoConnection=true and the named connection is not found, an exception is thrown.

  • Proxy misconfiguration (only one of proxyHost/proxyPort set) is detected by the proxyValid() check.

Common Pitfalls

Pitfall

Resolution

Forgetting &amp; in XML route URIs

In XML, & must be written as &amp; inside attribute values

Setting only proxyHost without proxyPort

Both must be set together; the proxyValid() check will reject partial configuration

Using connectionTimeoutMs for all timeouts

This is a legacy parameter. Prefer connectTimeoutMs, soTimeoutMs, and responseTimeoutMs for granular control.

Large response causes OOM

Set maxResponseSizeInMB to cap response size, or use disableStreamCache=true to stream to disk

Query params conflicting with component params

Named component parameters take priority. If your API has a query param with the same name as a component param (e.g., filter), use a workaround such as encoding it in the uri path directly.

Setting integration.pfx.* to tune pfx-rest calls

Wrong namespace. integration.pfx.* tunes the pricefx-client library (used by pfx-api calls into a PriceFx partition). For pfx-rest (non-PriceFx HTTP) use integration.pfx-rest.*.