When to use this endpoint

Use for partial mapped changes. Omitted mapped fields retain their current values; JSON values replace the complete property, not individual keys.

Authentication and permissions

Authenticate with signed API-key fields or a logged-in CRM session. These handlers perform no additional stock, finance, page-role, department or owner check; UI button permissions are not server authorization.

Data is scoped to the authenticated tenant. Session CSRF, signed-request checks and account routing still apply. No stockTracking feature gate is enforced in these handlers.

Requires tenant upgrade 796: stock bundle, storage and inventory tables must have deleted/ddate columns before deploying these handlers.

Parameters

ParameterTypeRequiredDescription
idInteger-compatible scalar or native arrayYesUpdate target; scalar integer-converts. Native arrays execute sequential updates, not one transaction; per-row errors/warnings are discarded and the bulk call returns ok.
nameStringNoSupplied non-empty name replaces the current value; omission leaves it unchanged. Blank is rejected, but whitespace is not trimmed. No uniqueness check.
stocksJSON text or native arrayNoStored component list, normally [{stockID:1042,qty:2}]. Replaces the entire saved list; no stock existence, quantity or schema validation is performed.
metaJSON text or objectNoReplaces the entire metadata value. No merge with existing keys.
widgetTableStockBundleJSON text or native arrayNoWidget rows use stockID and qty. Converted rows override stocks when supplied; unrecognized row keys, including id, are dropped. A present noConvert key bypasses conversion and is removed; this is a legacy internal control, not an integration format.
cdateUnix seconds or date/time stringNoCreation timestamp defaults to now; writable despite UI readonly metadata.
lastEditedUnix seconds or date/time stringNoCreation accepts a supplied value; omitted defaults to now. Changed updates set last_edited to server Unix seconds.

Example request

$saved = FM_api('StockBundle_updateData', ['id'=>'1042', 'name'=>'Service kit']);

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 omitted.
{"error":"missing or invalid parameter: name"}Supplied name is blank.
{"warning":"No data."}No target row found, or the mapped-column read fails.
{"warning":"No Change."}All supplied mapped values already match.
{"warning":"no updated fields."}No supplied field is mapped.

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

Behaviour and edge cases

  • UI readonly/hidden field metadata is not a write-access guard. Values integer-/float-convert according to the map; no minimum, finite-value or foreign-object validation is supplied here.
  • Updates are not atomic with history and do not check the write result before returning ok. Re-read saved values before replaying an uncertain response.
  • widgetTableStockBundle, when supplied, takes precedence over stocks. Its supported keys are stockID and qty; id is not an alias for stockID. The saved component list is replaced as a whole.
  • The mobile intermediary m/www/php/functions/syncDownloads.php reads stock_bundles as stockBundles. Current app code expands those locally synchronized components; it does not directly call this office endpoint.

Side effects

  • Writes stock_bundles and invalidates its cache. Changed updates record before/after history and set last_edited to server Unix seconds.
  • Does not update warehouse in_stock, allocate stock, create movement history, send emails, call an external service or fire a configured event.

See it in Fieldmotion

CRM1

No direct CRM1 caller was found for this exact endpoint; the legacy Stock page uses its separate catalog/container APIs.

CRM2

Open Stock Bundles. Its mapped table uses StockBundles_getDataTable; Create/Edit uses layoutStockBundleCreate/layoutStockBundleUpdate and the Layout stockBundle mapping. Filter Network for StockBundle_updateData. Bulk Delete posts one ID per request; direct updateField has no dedicated call in this page.

Related endpoints