Stock exports and reporting
List stock source choices
/a/Stock_containers
List work areas, users and vehicles for stock source selectors.
When to use this endpoint
Use to populate stock-source controls before separately loading quantities; these lists do not contain stock amounts.
Authentication and permissions
Authenticate with a signed API-key request or logged-in CRM session. The handler requires user login, but does not apply the stock-export permission guard.
All lookups use the authenticated tenant; no additional department or owner restriction is applied. Session CSRF and API signing still apply.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
last_edited | Datetime string | No | Implicit Vehicles_getReges parameter. A truthy value limits only vehicles to edits >= supplied timestamp and < server now. |
ids | JSON array string or native array | No | Implicit Vehicles_getReges parameter, used only when last_edited is falsey. Integer-converts/deduplicates vehicle IDs; no effect on users/work areas. |
Example request
$sources = FM_api('Stock_containers');
Example response
{"locations":[{"id":"3042","name":"Depot"}],"users":[{"id":"2042","name":"Engineer","active":"1"}],"vehicles":[{"id":"4042","reg":"VAN-01","last_edited":"2026-10-05 09:00:00"}]}
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. |
{"locations":[],"users":[],"vehicles":[]} | All source lists empty; authenticated tenant users can make users non-empty. |
{"error":"parameter should be a JSON array of IDs: ids"} | Invalid forwarded ids; the error appears nested as the vehicles value, not necessarily at the top level. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Requires login but no Stock view/export permission or stock-tracking feature check. Work areas exclude deleted rows and are ordered by name; users have no active/deleted filter and are ordered by name.
- Vehicles delegate to Vehicles_getReges using the same request: includes retained deleted vehicles, no default order, and optional last_edited or ids filtering. Invalid ids can return an error object nested under vehicles while the outer response still contains locations/users.
- Locations/users contain only the selected id/name (+active for users) columns. Warehouse is not an explicit returned row; UI callers add their own Warehouse choice.
- CRM1 can hide work-area choices with employer feature bit 524288; the API still returns them. No department or owner restriction is applied.
- No stock quantity, audit, edit timestamp, notification or event is changed. Reads across multiple queries are not a transactionally frozen snapshot.
- No paging/search option or result wrapper is implemented; the output is JSON, not CSV.
- No direct caller for this exact endpoint was found in the current app JavaScript or
m/wwwintermediary; these are office reporting/source-selection calls, not the app download protocol.
Side effects
- Read-only; does not create a CSV file, mutate stock or run configured events.
See it in Fieldmotion
CRM1
Job stock, Quote Costs and Invoice stock source selectors load Stock_containers. Warehouse is added locally; user/vehicle/work-area choices come from this response.
CRM2
Invoice and SOR stock widgets load Stock_containers to populate source lists; filter Network while opening a stock source selector.
Related endpoints
Stock_exportSummaryprovides the CSV destination-type summary.Stock_getCostsprovides single-item costing defaults.Stock_getNamesresolves catalog labels.