Work areas and stock categories
Retrieve mapped category projections
/a/StockCategory_getRequestedDetails
Load category nodes and membership for the CRM2 tree or stock-category picker.
When to use this endpoint
StockCategory_updateData patches the selected node using these same aliases. Tree construction is performed by the CRM2 caller, not this detail response.
Categories organize stock membership and parent/child navigation; these calls do not transfer physical stock or change quantities. Select the legacy or mapped API that matches your field names.
Authentication and permissions
Authenticate using signed API-key fields or a logged-in CRM session. All object queries use the authenticated tenant. The handler has no additional page, role or feature check unless stated below.
Sign numeric request values as strings, including nested native arrays; only JSON-encode parameters that explicitly accept JSON text. See Getting started.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id / ids | Scalar integer-compatible or native array | No | id takes precedence. Scalars become one integer ID; array values are integer-converted. Omitted IDs or an empty array impose no ID restriction; JSON text is not a batch list. |
fields | Native array | No | Defaults to every mapped field: id, name, parentID, stock, lastEdited. Unknown names ignored; id automatically included. JSON strings are not decoded. |
Mapped field filters | Scalar or native array | No | Use mapped names id, name, parentID, stock, lastEdited. Filters are ANDed: strings match trimmed case-insensitive equality; arrays use IN. Numeric scalar filters are integer-converted, even coordinates; numeric arrays retain only numeric members and integer-convert them. |
order | Ignored | No | Ignored; handler always sorts by mapped parentID then name ascending. |
advanceSearch | Native array | No | Legacy advanced rules with column/id, condition and value; equal, notEqual, contains, greaterThan, greaterThanOrEqual, lesserThan, lesserThanOrEqual. andOr joins to the next rule (AND/OR/XOR), special adds parentheses. Raw where clauses are rejected. Use mapped-field rules only. |
Example request
$result = FM_api('StockCategory_getRequestedDetails', ['fields'=>['id','name','parentID','stock']]);
Example response
[{"id":"1042","name":"Parts","parentID":"0","stock":null}]
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"} | An advanced rule includes raw where SQL. |
{"error":"missing or invalid parameter: fields"} | A supplied fields value is not a native string array. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Uses parentID and lastEdited aliases. Always includes id; stock remains comma-separated text/null, not expanded items.
- No pagination. Missing IDs omitted; empty IDs/omission selects all matches. Query failure is normalized to [].
- Only non-deleted categories are read or changed. No quantity, price or accounting-provider availability check is applied.
- The source search found no direct caller in the mobile JavaScript app or its
m/wwwintermediary for this endpoint. - Rejects raw advanced-search
whereclauses and non-native fields/advanced-rule arrays before invoking the mapped helper. - Fixed ordering is parentID then name ascending; caller order is overwritten.
Side effects
- Read-only; no object writes, audit entries or notifications are performed.
See it in Fieldmotion
CRM1
No direct CRM1 caller was found for this endpoint. The legacy Stock Categories screen uses StockCategory_get and StockCategories_listByParent.
CRM2
Stock Categories initial tree load and maintenance list use StockCategory_getRequestedDetails with id/name/parentID/stock. The stock module’s picker also uses it.
Related endpoints
StockCategories_listretrieves a flat category projection.StockCategory_updateDatapatches category fields and refreshes affected stock summaries.