Stock inventory, storage and bundles
Fetch mapped storage location records for detail/source controls
/a/StockStorage_getRequestedDetails
Fetch mapped storage location 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, parentID, lastEdited. 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('StockStorage_getRequestedDetails', ['id'=>['1042'], 'fields'=>['id','name']]);
Example response
[{"id":"1042","name":"Parts cabinet"}]
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":"failed to create default stock location"} | The checked default-location insert fails. |
{"error":"unsupported raw advanced search"} | advanceSearch contains a raw where key. |
{"error":"missing or invalid parameter: orderDesc"} | Explicit order direction is not asc/desc. |
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 [].
- When id is absent and the filtered read is empty, attempts INSERT IGNORE of id=1, parent_id=0, name=Company, then repeats the same filtered read. ids or other filters do not disable this fallback. Existing ID 1 is not overwritten; filters may still yield [].
- 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
- An empty id-omitted lookup can create the default Company location and invalidate the storage cache. This fallback does not use mapped creation history. Other reads are read-only.
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_getRequestedDetails. The UI hides deletion of location 1 and checks inventory first; the delete handler does not enforce those UI safeguards.
Related endpoints
StockStorage_createDatacreates a new storage location rather than changing physical warehouse stock.