Suppliers
Delete stock-supplier relationships
/a/StockSupplier_deleteData
Permanently delete stock-to-supplier relationship rows matching one or more mapped filters.
When to use this endpoint
Use StockSupplier_deleteData to remove known association rows. Supply id for the narrowest and safest deletion.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session. The handler calls the normal login guard but performs no additional Suppliers-page, stock, purchasing, role, create, edit, or delete permission check.
All records are selected from the authenticated tenant. CRM1 and CRM2 hide some controls through client-side permissions, but these endpoints do not repeat those UI checks.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible or native array | Recommended | Relationship-row ID(s). A scalar uses equality and an array uses IN. |
Other mapped filters | Scalar or native array | Conditional | Any field from id, name, stockID, supplierID, supplier, locationID, qty, cost, price, partNumber, and lastEdited can filter deletion. Multiple supplied fields are AND-combined. At least one usable filter is required. |
Example request
$result = FM_api('StockSupplier_deleteData', ['id' => '9021']);
Example response
{"ok":1}
Errors and unusual responses
| Response | Condition |
|---|---|
{"error":"not logged in"} | No authenticated tenant context is available. Invalid signed credentials can be rejected by the dispatcher before the handler runs. |
{"error":"missing or invalid filter"} | No mapped filter is supplied. |
{"ok":1} | The filter is valid but matches no relationship row; no not-found error is returned. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Numeric values are integer-converted except float/date/string mapped fields, which follow shared filter conversion. Empty numeric arrays deliberately match nothing.
- The endpoint does not delete the supplier or stock record itself.
- It returns success even when nothing matched.
Side effects
- Matched rows are removed physically, logged in the tenant deletion log under
stock_suppliers, recorded in Core history, and evicted from cache.
See it in Fieldmotion
CRM1
The legacy Stock supplier editor normally replaces its complete list through StockSupplier_setSuppliers rather than calling this route directly.
CRM2
Mapped list controls can call StockSupplier_deleteData for a selected association row.
Related endpoints
StockSupplier_setSuppliersreplaces all relationships for a stock item.StockSupplier_createDatacreates one row.