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 (enum) |
-- |
The Pricefx object type to import into (e.g., |
|
|
String |
-- |
The file name for the import. Used to identify the import job on the server. |
|
|
String |
-- |
Reference to a staging file already uploaded to Pricefx. If provided, the import reads from this file instead of the exchange body. |
|
|
Boolean |
true |
Whether to delete the staging file after import completes. |
|
|
Boolean |
false |
Whether to truncate the target object before importing. |
|
|
Boolean |
true |
Whether to deduplicate records during import. |
|
|
Boolean |
false |
Whether to skip indexing during import (faster for large imports, but search will be stale until re-indexed). |
|
|
char |
|
CSV field delimiter. |
|
|
char |
|
Character used for quoting CSV fields. |
|
|
char |
|
Escape character for special characters within CSV fields. |
|
|
String |
(empty string) |
String that represents a null value in the CSV input. |
|
|
String |
(carriage return + line feed) |
Record separator (end of line) for the CSV input. |
|
|
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 |
|---|---|---|
|
|
Integer |
Number of input records in the current batch. |
|
|
Integer |
Total number of input records processed across all batches. |
|
|
Integer |
Total number of failed input records. |
XML Route Examples
Basic server-side import from body
<route>
<from uri="direct:serverImport"/>
<to uri="pfx-api:import?objectType=P&fileName=products.csv&truncate=false&deDuplicate=true"/>
</route>
Import with truncation before load
<route>
<from uri="direct:importWithTruncate"/>
<to uri="pfx-api:import?objectType=P&fileName=products.csv&truncate=true&deDuplicate=true"/>
</route>
Import from a staging file
<route>
<from uri="direct:importFromStaging"/>
<to uri="pfx-api:import?objectType=P&stagingFile=uploads/products.csv&deleteStagingFileAfterImport=true"/>
</route>
Import with custom CSV formatting
<route>
<from uri="direct:importCustomCsv"/>
<to uri="pfx-api:import?objectType=P&fileName=products.csv&delimiter=;&skipIndexing=true"/>
</route>
Import with explicit headers
When the CSV file does not contain a header row, specify headers explicitly:
<route>
<from uri="direct:importWithHeaders"/>
<to uri="pfx-api:import?objectType=P&fileName=products.csv&headers=sku,label,attribute1,attribute2"/>
</route>
Import from S3
When reading from S3, the CamelAwsS3Key header is used as the file name:
<route>
<from uri="aws2-s3://my-bucket?prefix=imports/"/>
<to uri="pfx-api:import?objectType=P&deDuplicate=true"/>
</route>
Common Pitfalls
-
fileName or stagingFile: You should provide either
fileName(for body-based import) orstagingFile(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=trueexplicitly. -
skipIndexing trade-off: Setting
skipIndexing=truespeeds 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
delimiterdoes 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
eolparameter accordingly. -
Check import statistics: After import, inspect the
PfxTotalInputRecordsCountandPfxTotalFailedInputRecordsCountheaders to verify that all records were imported successfully.