pfx-api:update

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

ObjectType (enum)

--

The Pricefx object type of the record to update (e.g., P, C, PL, PX, etc.).

typedId

String

--

The typedId of the record to update (e.g., 123.P, 45.PL).


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

XML
<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&amp;typedId=123.P"/>
</route>

Update with dynamic typedId from header

You can set the typedId dynamically via a Camel header or property:

XML
<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

XML
<route>
    <from uri="direct:updatePriceList"/>
    <to uri="pfx-api:update?objectType=PL&amp;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 typedId suffix matches the objectType (e.g., 123.P with objectType=P).