Stock inventory, storage and bundles
Replace supplied mapped storage location values
/a/StockStorage_updateData
Replace supplied mapped storage location values.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible scalar or native array | Yes | Update target; scalar integer-converts. Native arrays execute sequential updates, not one transaction; per-row errors/warnings are discarded and the bulk call returns ok. |
name | String | No | Supplied non-empty name replaces the current value; omission leaves it unchanged. Blank is rejected, but whitespace is not trimmed. No uniqueness check. |
parentID | Integer-compatible scalar | No | Maps to parent_id; 0 denotes a root. No parent existence, cycle, ownership or hierarchy validation. |
lastEdited | Unix seconds or date/time string | No | Creation accepts it or defaults to now. Changed updates set server Unix seconds regardless of a submitted edit timestamp. |
Example request
$saved = FM_api('StockStorage_updateData', ['id'=>'1042', 'name'=>'Parts cabinet']);
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 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.
- Does not verify a parent exists, reject self-parenting/cycles or prevent editing the Company root. Parent changes only rewrite parent_id, not inventories.
- No exact caller was found in current app JavaScript or m/www for this office endpoint; app stock quantities use the separate mobile sync/transaction paths.
Side effects
- Writes stock_storages 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 Locations. The tree loads StockStorage_getRequestedDetails; Create and rename/parent saves use mapped createData/updateData helpers. Drag nodes then Save to write parentID. Filter Network for StockStorage_updateData. The UI hides deletion of location 1 and checks inventory first; the delete handler does not enforce those UI safeguards.
Related endpoints
StockStorage_getRequestedDetailsreads stored mapped values; an omitted ID can retrieve all active tenant rows.StockStorage_createDatacreates a new storage location rather than changing physical warehouse stock.