Stock inventory, storage and bundles
Summarize saved inventory quantities by storage and stock item
/a/StockInventory_getQTYSummary
Summarize saved inventory quantities by storage and stock item.
When to use this endpoint
Use for the stock detail location totals. This sums saved inventory balances, not warehouse-only available quantities after allocations.
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 |
|---|---|---|---|
stockID | Integer-compatible scalar | No | Presence adds exact stock_id after integer conversion. Omitted sums all tenant inventory; explicit blank/0 restricts to stock ID 0. |
Example request
$rows = FM_api('StockInventory_getQTYSummary', ['stockID'=>'1042']);
Example response
[{"totalQTY":"2.5","storageName":"Parts cabinet","stockName":"Filter cartridge"}]
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. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Groups by storage_id and stock_id, ordered by storage ID then stock name. Returns only totalQTY, storageName and stockName, not their IDs.
- Includes zero/negative active balances and references to deleted/archived catalog stock, but excludes deleted inventory. Deleted/missing storage names are null. No allocation subtraction, pagination/date range or status filter is applied.
- Database failure can return false rather than an error object.
- 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
- Read-only; no stock/inventory reconciliation or 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 a stock item's storage-quantity summary in Stocks; moduleStocks calls StockInventory_getQTYSummary with the catalog ID. Filter Network for that exact request.
Related endpoints
StockInventory_getRequestedDetailsreads stored mapped values; an omitted ID can retrieve all active tenant rows.StockInventory_createDatacreates a new inventory row rather than changing physical warehouse stock.