pfx-api:save
Save (create or full-replace) a single record in Pricefx. The exchange body must be a data map that includes the typedId field identifying the record.
Parameters
|
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
ObjectType (enum) |
-- |
The Pricefx object type to save (e.g., |
|
|
String |
-- |
The typedId of the record. Can also be provided inside the body map. |
|
|
String |
-- |
Optional mapper bean name to transform the body before saving. |
Body Requirements
The exchange body must be a data map (Map<String, Object>) representing the full record. The map should include the typedId field to identify the record. If the record exists, it is replaced; if it does not exist, it is created.
XML Route Examples
Save a product record
<route>
<from uri="direct:saveProduct"/>
<!-- Body should be a Map including typedId, e.g., {"typedId": "123.P", "sku": "SKU001", "label": "My Product"} -->
<to uri="pfx-api:save?objectType=P"/>
</route>
Save with explicit typedId
<route>
<from uri="direct:saveWithTypedId"/>
<to uri="pfx-api:save?objectType=P&typedId=123.P"/>
</route>
Save with a mapper
Use a mapper to transform the incoming data before saving:
<route>
<from uri="direct:saveWithMapper"/>
<to uri="pfx-api:save?objectType=P&mapper=productSaveMapper"/>
</route>
Common Pitfalls
-
Body must include typedId: The body map must contain a
typedIdfield (or thetypedIdURI parameter must be set). Without it, the save operation cannot identify the target record. -
Full replace, not partial update: Unlike
pfx-api:update, thesavemethod performs a full replacement of the record. Fields not present in the body map may be reset to their defaults. Useupdatefor partial modifications. -
Body must be a Map: The exchange body must be a
Map<String, Object>. Other types (JSON strings, POJOs) are not automatically converted. -
Object type must match: Ensure the
typedIdsuffix corresponds to theobjectTypeparameter.