Stock inventory, storage and bundles
Fetch mapped inventory row records for detail/source controls
/a/StockInventory_getRequestedDetails
Fetch mapped inventory row records for detail/source controls.
When to use this endpoint
Use when you already know an ID, or need an unpaged source list. Request explicit fields to keep the response small; this is not the paged DataTable endpoint.
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 | No | Integer-converted IDs; takes precedence over ids. Omitted means no ID restriction. A native empty array also removes the ID restriction, not an empty result. JSON-encoded ID lists are not decoded. |
ids | Integer-compatible scalar or native array | No | Alias used only when id is absent; same conversion and empty-list behavior. |
fields | Native array of field-name strings | No | Omission selects all mapped fields: id, name, stockID, supplierID, supplier, storageID, storage, goodReceivedID, qty, cost, price, reference, receivedDate, lastEdited, cdate. Unknown/non-string names are ignored; id is always included. JSON text is not decoded here. |
Mapped field filters | Scalars or native arrays | No | The mapped names above may also restrict results. Text scalar filters are trimmed, lower-case exact matches (not contains); arrays use IN. Numeric filters integer-convert, including float fields. Filters combine with AND. |
order | Field name, list, or objects {id,dir} | No | Mapped names only; dir=desc reverses that field. No default order is declared. No pagination/limit/start controls are consumed. |
advanceSearch | Native array | No | Native structured conditions on mapped columns: column/id, condition and scalar/native-array value, with optional AND/OR connector and bracket marker. Raw where clauses are rejected. Supported conditions: equal, notEqual, contains, greaterThan, greaterThanOrEqual, lesserThan, lesserThanOrEqual. |
Example request
$rows = FM_api('StockInventory_getRequestedDetails', ['id'=>['1042'], 'fields'=>['id','name']]);
Example response
[{"id":"1042","name":"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. |
{"error":"unsupported raw advanced search"} | advanceSearch contains a raw where key. |
{"error":"missing or invalid parameter: orderDesc"} | Explicit order direction is not asc/desc. |
{"error":"inventory read failed"} | A linked supplier/storage lookup fails. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Returns an array, even for one ID; missing IDs are omitted. Unknown fields are ignored, id is included, and no default ordering/result limit is imposed. Empty IDs do not safely mean no rows.
- Database numeric values remain strings/null. datetimeUnix fields are selected with FROM_UNIXTIME and returned as database-formatted date/time strings, not Unix numbers.
- Mapped reads exclude soft-deleted main rows. No additional catalog deleted/archive check is added. Query failure and a genuinely empty selection can both become [].
- qty/cost/price request filters integer-convert, even though saved values and output retain decimals.
- 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.
- Requested supplier/storage values are {id,name} for the linked supplier or storage, fetched in tenant-local batches. Missing or deleted suppliers return null members. Scalar supplierID/storageID remain available; internally added aliases are removed from an explicit projection.
- Deleted inventory rows are excluded. A deleted or missing linked storage has null id/name members, just like a missing linked supplier.
Side effects
- Read-only; no movement, warehouse quantity update, history, configured event or notification.
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 Inventory or a Stock Location's inventory table. The table uses StockInventories_getDataTable through the StockInventory/StockInventories prefixes; mapped detail helpers read StockInventory_getRequestedDetails. Filter Network for StockInventory_getRequestedDetails.
Related endpoints
StockInventory_createDatacreates a new inventory row rather than changing physical warehouse stock.