The components of a kit have quantities, can themselves be kits, and factor into the price calculation. Use the business operations below rather than the generic related-list operations.
All operations use Webservice IDs. Reading requires access to the kit and to each of its components. Any modification also requires the right to modify the kit.
Read the composition #
GET
https://apps.kafinea.com/{instance}/webservice.php
| Parameter | Type | Required | Description |
|---|---|---|---|
operation |
string | yes | product_kit_get_components |
sessionName |
string | yes | Session identifier |
kitId |
string | yes | Kit Webservice ID |
curl "https://apps.kafinea.com/YourKafinea/webservice.php?operation=product_kit_get_components&sessionName=YOUR_SESSION_ID&kitId=14x120"
The response contains components with the ID, code, name, and quantity of each component. integrityIssues flags old references whose product has been deleted or no longer exists.
Replace the entire composition #
POST
https://apps.kafinea.com/{instance}/webservice.php
| Parameter | Type | Required | Description |
|---|---|---|---|
operation |
string | yes | product_kit_set_components |
sessionName |
string | yes | Session identifier |
kitId |
string | yes | Kit Webservice ID |
components |
JSON | yes | Array of desired components and quantities |
curl -X POST https://apps.kafinea.com/YourKafinea/webservice.php \
-d "operation=product_kit_set_components" \
-d "sessionName=YOUR_SESSION_ID" \
-d "kitId=14x120" \
--data-urlencode 'components=[{"id":"14x201","quantity":2},{"id":"14x202","quantity":1.5}]'
This operation is idempotent: repeating the exact same request keeps the same composition. All requested components are validated before the first write. An existing but inaccessible product therefore blocks the entire operation.
An orphaned reference already present in the kit does not block the repair. It is removed during the replacement and counted in removedOrphans.
Add a component or change its quantity #
Use product_kit_add_component with kitId, componentId, and a strictly positive quantity. If the component is already present, its quantity is replaced.
curl -X POST https://apps.kafinea.com/YourKafinea/webservice.php \
-d "operation=product_kit_add_component" \
-d "sessionName=YOUR_SESSION_ID" \
-d "kitId=14x120" \
-d "componentId=14x203" \
-d "quantity=3"
Remove a component #
Use product_kit_remove_component with kitId and componentId. The operation has no effect if the component is not present.
Rules and errors #
All four operations apply the same rules as the Kafinea screen:
- a quantity must be greater than zero;
- a kit cannot contain itself, directly or indirectly;
- a generic or specific product can be a component, but cannot itself become a kit;
- the price is recalculated after a modification when the pricing mode provides for it;
- an authorization error names the parameter or action that was denied without revealing the protected content.