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

ParameterTypeRequiredDescription
idInteger-compatible scalar or native arrayNoInteger-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.
idsInteger-compatible scalar or native arrayNoAlias used only when id is absent; same conversion and empty-list behavior.
fieldsNative array of field-name stringsYesRequired native field-name array; mapped names are id, name, stocks, meta, cdate, lastEdited, plus widgetTableStockBundle. Unknown/non-string names are ignored and id is always included. JSON text is not decoded.
Mapped field filtersScalars or native arraysNoThe 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.
orderField name, list, or objects {id,dir}NoMapped names only; dir=desc reverses that field. No default order is declared. No pagination/limit/start controls are consumed.
advanceSearchNative arrayNoNative 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('StockBundle_getLayoutDetails', ['id'=>['1042'], 'fields'=>['name','widgetTableStockBundle']]);

Example response

[{"name":"Service kit","widgetTableStockBundle":[{"stockID":"2042","qty":"2"}],"id":"1042"}]

Errors and unusual responses

ResponseCondition
{"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: fields"}fields is omitted.
{"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 [].
  • stocks/meta are returned as stored JSON text, not decoded component objects. Reading does not expand a bundle into inventory allocations.
  • Requesting widgetTableStockBundle adds stocks internally, converts stockID/qty keys and strips internally added stocks unless explicitly requested. Empty stocks yields an empty widget array; components are not hydrated with current catalog names or availability.
  • The mobile intermediary m/www/php/functions/syncDownloads.php reads stock_bundles as stockBundles. Current app code expands those locally synchronized components; it does not directly call this office endpoint.

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 Bundles. Its mapped table uses StockBundles_getDataTable; Create/Edit uses layoutStockBundleCreate/layoutStockBundleUpdate and the Layout stockBundle mapping. Filter Network for StockBundle_getLayoutDetails. Bulk Delete posts one ID per request; direct updateField has no dedicated call in this page.

Related endpoints