pfx-api:update
Update a single existing record in Pricefx by its typedId. The exchange body must contain the data map with the fields to update.
Parameters
|
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
|
ObjectType (enum) |
-- |
The Pricefx object type of the record to update (e.g., |
|
|
String |
-- |
The typedId of the record to update (e.g., |
Body Requirements
The exchange body must be a data map (Map<String, Object>) containing the fields you want to update. Only the fields present in the map will be modified; other fields remain unchanged.
XML Route Examples
Update a product record
<route>
<from uri="direct:updateProduct"/>
<!-- Body should be a Map with fields to update, e.g., {"attribute1": "NewValue"} -->
<to uri="pfx-api:update?objectType=P&typedId=123.P"/>
</route>
Update with dynamic typedId from header
You can set the typedId dynamically via a Camel header or property:
<route>
<from uri="direct:updateDynamic"/>
<setHeader name="CamelPfxApiTypedId">
<simple>${header.recordTypedId}</simple>
</setHeader>
<to uri="pfx-api:update?objectType=P"/>
</route>
Update a Price List
<route>
<from uri="direct:updatePriceList"/>
<to uri="pfx-api:update?objectType=PL&typedId=45.PL"/>
</route>
Common Pitfalls
-
Body must be a Map: The exchange body must be a
Map<String, Object>. Passing a JSON string, a POJO, or a list will cause an error or unexpected behavior. -
typedId is required: You must specify which record to update via
typedId. Without it, the operation will fail. -
Partial update: Only fields present in the body map are updated. To clear a field, include it in the map with a null value.
-
Object type mismatch: Ensure the
typedIdsuffix matches theobjectType(e.g.,123.PwithobjectType=P).