When to use this endpoint

Read ledger record IDs, not catalogue stock IDs or source owner IDs. To find records for a stock item use stockID as a mapped filter.

Authentication and permissions

Authenticate with a signed API key or a logged-in CRM session on the account’s routed host. Signed requests act as the key owner. Session requests must include the dispatcher CSRF value when configured. All record identifiers belong to the authenticated tenant.

The dispatcher and these handlers do not impose an additional CRM2 Stock role or Stock TeamAccess record scope. CRM2 screen permissions are separate controls and must not be assumed to apply to CRM1. These routes do not become public because an individual legacy handler checks only the tenant context.

Parameters

ParameterTypeRequiredDescription
id / idsScalar or native ID arrayNoAllocation/ledger row IDs, not stock IDs. id takes precedence; omission or an empty native array leaves the ID restriction unset.
fieldsNative field-name arrayNo; defaults to mapped fieldsMapped names: id, stockID, linkID, linkType, link, customerID, customerType, customer, qty and createdDate. Use a nonempty native list, not JSON text.
Mapped filters / order / advanceSearchNative values/arraysNoMapped equality filters and typed advanced-search rules; order uses mapped names or {id,dir}. Raw where SQL is rejected.

Example request

$rows = FM_api('StockDispatch_getRequestedDetails', ['id'=>['3081'],'fields'=>['id','stockID','qty','link','createdDate']]);

Example response

[{"id":"3081","stockID":"1042","qty":"2.5","link":{"id":"2088","type":"7"},"createdDate":"2026-11-23 10:00:00"}]

Examples show one representative result; database numeric scalars can be JSON strings. Application errors can use HTTP 200: inspect error and warning in the decoded response.

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":"invalid advanced search"}Raw where SQL in advanceSearch.

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

Behaviour and edge cases

  • Use native arrays for fields and ID selections; these wrappers do not decode JSON strings into those arrays. The response is a bare row array. id is always included; missing records are omitted, with no requested-ID ordering or pagination.
  • Omitting id/ids, or supplying an empty native ID array, adds no ID restriction and can read the whole matching table. Use a deliberate nonempty selection. id takes precedence over ids.
  • Mapped scalar/list filters combine with AND. Numeric equality filters integer-convert values; text equality is case-insensitive and trimmed. order accepts mapped names or native {id,dir} entries. Unknown projected names are ignored; stored JSON is not generally decoded into objects.
  • These allocation/ledger tables have no automatic deleted-row filter in the shared reader and are not joined to active stock/owners unless the endpoint explicitly says so. A retained allocation/history can therefore refer to a missing, archived or deleted business record.
  • This wrapper permits omitted fields; the shared reader then requests all mapped names. link and customer are composite id/type objects. createdDate is formatted from the saved epoch using the database session timezone, rather than returned as an epoch.
  • No positive-quantity filter or inferred stock movement is applied. A dispatch record can survive removal of the underlying allocation.

Side effects

  • Database reads only; no reservation, movement, alert or history entry is created.

See it in Fieldmotion

CRM1

No direct CRM1 caller was found in the source search. CRM1 uses its legacy Stock grid and stockContainerEdit allocation editor instead.

CRM2

No direct CRM2 browser caller for this detail route was found. The dispatch dialog loads candidates through StockContainer_getDispatch and writes through Stock_dispatch.

Related endpoints