pfx-api:import

pfx-api:import

Perform a server-side import using the Pricefx Import API. Reads CSV data from the exchange body or from a staging file reference. This method supports options for truncation, deduplication, indexing control, and CSV formatting.


Parameters

Parameter

Type

Default

Description

objectType

ObjectType (enum)

--

The Pricefx object type to import into (e.g., P, C, PX, CX, LTV, MLTV, etc.).

fileName

String

--

The file name for the import. Used to identify the import job on the server.

stagingFile

String

--

Reference to a staging file already uploaded to Pricefx. If provided, the import reads from this file instead of the exchange body.

deleteStagingFileAfterImport

Boolean

true

Whether to delete the staging file after import completes.

truncate

Boolean

false

Whether to truncate the target object before importing.

deDuplicate

Boolean

true

Whether to deduplicate records during import.

skipIndexing

Boolean

false

Whether to skip indexing during import (faster for large imports, but search will be stale until re-indexed).

delimiter

char

,

CSV field delimiter.

quoteCharacter

char

'

Character used for quoting CSV fields.

escapeCharacter

char

"

Escape character for special characters within CSV fields.

nullValue

String

(empty string)

String that represents a null value in the CSV input.

eol

String

(carriage return + line feed)

Record separator (end of line) for the CSV input.

headers

String

--

Comma-separated column headers for the CSV input. If not provided, the first row of the CSV is treated as the header.


Headers Set by the Component

Header

Type

Description

PfxInputRecordsCount

Integer

Number of input records in the current batch.

PfxTotalInputRecordsCount

Integer

Total number of input records processed across all batches.

PfxTotalFailedInputRecordsCount

Integer

Total number of failed input records.


XML Route Examples

Basic server-side import from body

XML
<route>
    <from uri="direct:serverImport"/>
    <to uri="pfx-api:import?objectType=P&amp;fileName=products.csv&amp;truncate=false&amp;deDuplicate=true"/>
</route>

Import with truncation before load

XML
<route>
    <from uri="direct:importWithTruncate"/>
    <to uri="pfx-api:import?objectType=P&amp;fileName=products.csv&amp;truncate=true&amp;deDuplicate=true"/>
</route>

Import from a staging file

XML
<route>
    <from uri="direct:importFromStaging"/>
    <to uri="pfx-api:import?objectType=P&amp;stagingFile=uploads/products.csv&amp;deleteStagingFileAfterImport=true"/>
</route>

Import with custom CSV formatting

XML
<route>
    <from uri="direct:importCustomCsv"/>
    <to uri="pfx-api:import?objectType=P&amp;fileName=products.csv&amp;delimiter=;&amp;skipIndexing=true"/>
</route>

Import with explicit headers

When the CSV file does not contain a header row, specify headers explicitly:

XML
<route>
    <from uri="direct:importWithHeaders"/>
    <to uri="pfx-api:import?objectType=P&amp;fileName=products.csv&amp;headers=sku,label,attribute1,attribute2"/>
</route>

Import from S3

When reading from S3, the CamelAwsS3Key header is used as the file name:

XML
<route>
    <from uri="aws2-s3://my-bucket?prefix=imports/"/>
    <to uri="pfx-api:import?objectType=P&amp;deDuplicate=true"/>
</route>

Common Pitfalls

  • fileName or stagingFile: You should provide either fileName (for body-based import) or stagingFile (for pre-uploaded file import). If neither is set, the component will attempt to derive the name from S3 headers or exchange file name.

  • truncate is false by default: If you need to clear existing data before importing, set truncate=true explicitly.

  • skipIndexing trade-off: Setting skipIndexing=true speeds up large imports but leaves search indexes stale. Run a reindex or wait for the scheduled reindex to complete before relying on search results.

  • CSV delimiter conflicts: Ensure the delimiter does not appear within field values unless those fields are properly quoted. The default delimiter is comma (,).

  • eol parameter: The default end-of-line separator is carriage return + line feed. If your CSV uses a different line ending, set the eol parameter accordingly.

  • Check import statistics: After import, inspect the PfxTotalInputRecordsCount and PfxTotalFailedInputRecordsCount headers to verify that all records were imported successfully.