When to use this endpoint

Use StockSupplier_updateData to change cost, price, part number, or another mapped value without replacing the stock item’s complete supplier list.

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

ParameterTypeRequiredDescription
idInteger-compatible or arrayYesRelationship-row ID. The shared updater accepts either one ID or a native array.
nameStringNoRelationship label, normally copied from the stock item name.
stockIDInteger-compatibleNoStock item ID. The endpoint integer-converts it but does not verify that the stock item exists.
supplierIDInteger-compatibleNoSupplier ID. The endpoint integer-converts it but does not verify that an active supplier exists.
locationID, qtyInteger-compatibleNoOptional location and quantity values, converted with intval().
cost, priceNumeric-compatibleNoPer-unit cost and price, converted with floatval().
partNumberStringNoSupplier-specific part number.
lastEditedUnix timestamp or date stringNoStored as a Unix timestamp. Creation defaults to the current server time; a nonnumeric value is parsed with strtotime().

Example request

$result = FM_api('StockSupplier_updateData', [
	'id' => '9021',
	'cost' => '13.25',
	'price' => '19.50',
	'partNumber' => 'NS-8201-B',
]);

Example response

{"ok":1}

Errors and unusual responses

ResponseCondition
{"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 parameter: id"}id is absent.
Field-specific validation errorA supplied mapped value cannot be converted or validated.
{"ok":1}The ID is unknown or no writable fields are supplied; this shared updater does not return not-found.

Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.

Behaviour and edge cases

  • Only supplied mapped fields are changed. Omitted fields remain untouched.
  • A native ID array updates each row in turn. Individual failures are discarded and the wrapper returns {"ok":1} after the loop, so scalar IDs are safer for error handling.
  • Normal changes advance lastEdited to the current server Unix timestamp unless that field is explicitly supplied.
  • The table has no soft-delete state; every matching row is directly updated.

Side effects

  • Changed fields are recorded in Core history and the stock_suppliers cache is invalidated.

See it in Fieldmotion

CRM1

No dedicated CRM1 caller was found; the legacy Stock editor normally replaces the complete relationship list.

CRM2

CRM2 generic mapped controls can use this route for individual relationship-row edits.

Related endpoints