When to use this endpoint

StockCategories_listByParent is the nested-tree alternative; this flat projection is useful when the caller constructs its own options.

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

ParameterTypeRequiredDescription
fieldsNative array or JSON array textYesAllowed stored fields: id, name, parent_id, stock, last_edited. Unknown fields are ignored; a supplied list with no valid selections returns an error. Omission selects all allowed fields.

Example request

$result = FM_api('StockCategories_list', ['fields'=>['id','name']]);

Example response

[{"id":"1042","name":"Parts"}]

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"}No valid fields provided.

Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.

Behaviour and edge cases

  • Unlike getById, fields must select at least one allowed column. id is not automatically added. Native arrays and JSON array text are accepted.
  • No parent filter, recursion, ordering, paging or search. No matches return []; stock remains CSV text/null.
  • The field list preserves repeated valid names, but SQL result objects do not duplicate keys.
  • 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/www intermediary for this endpoint.

Side effects

  • Read-only; no object writes, audit entries or notifications are performed.

See it in Fieldmotion

CRM1

Stock page initial category options request StockCategories_list with selected raw fields; filter that function name.

CRM2

No direct CRM2 caller was found for this endpoint. CRM2 Stock Categories uses mapped StockCategory_getRequestedDetails reads and generic create/update/delete helpers.

Related endpoints