Stock inventory, storage and bundles
Create a storage location definition without moving physical stock
/a/StockStorage_createData
Create a storage location definition without moving physical stock.
When to use this endpoint
Use for a new storage location. This is a metadata/row insertion, not a goods-received or stock movement transaction.
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 |
|---|---|---|---|
name | String | Yes | Non-empty name; no uniqueness check. Whitespace is not trimmed by the required-value 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_createData', ['name'=>'Parts cabinet']);
Example response
{"ok":1,"id":1042}
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: name"} | Required name omitted or blank. |
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.
- Creation is not atomic with history, and the insert result is not checked for a positive ID 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. Records mapped-field Core_log creation history.
- 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_createData. 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.