When to use this endpoint

Use StockSupplier_getRequestedDetails to load supplier pricing/part-number associations for stock items or all associated stock for a supplier.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler calls the normal login guard but performs no additional Suppliers-page, stock, purchasing, role, create, edit, or delete permission check.

All records are selected from the authenticated tenant. CRM1 and CRM2 hide some controls through client-side permissions, but these endpoints do not repeat those UI checks.

Parameters

ParameterTypeRequiredDescription
fieldsNative arrayNoMapped fields to return. Omission requests every mapped field. Available names are id, name, stockID, supplierID, supplier, locationID, qty, cost, price, partNumber, and lastEdited.
id or idsInteger-compatible or native arrayNoRelationship-row IDs. id takes precedence when both are present.
Mapped field filtersScalar or native arrayNoAny mapped field can filter. Text values are case-insensitive exact matches; numeric values are integer-converted. Common filters are stockID and supplierID.
orderMapped field, field object, or native arrayNoOptional ordering; objects use {"id":"cost","dir":"desc"}.
showInactiveStockInteger-compatibleNoExact integer 0 joins the stock table and excludes archived stock. Omission or any nonzero value includes associations for archived stock.

Example request

$rows = FM_api('StockSupplier_getRequestedDetails', [
	'fields' => ['id', 'stockID', 'supplierID', 'name', 'cost', 'partNumber'],
	'supplierID' => '488104',
	'showInactiveStock' => '0',
	'order' => [['id' => 'name', 'dir' => 'asc']],
]);

Example response

[
  {"id":"9021","stockID":"8201","supplierID":"488104","name":"Northshore Components","cost":"12.50","partNumber":"NS-8201"}
]

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.
[]No relationship matches every filter, or active-only mode excludes the associated stock.
Runtime/type errorfields is supplied as a string rather than the native array consumed by the shared reader.

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

Behaviour and edge cases

  • There is no pagination or implicit row limit.
  • The relationship table has no deleted flag. When active-only mode is enabled, the inner join also drops associations whose stock row is missing.
  • Requesting supplier returns a nested display object assembled from the linked non-deleted supplier. A missing/deleted linked supplier does not remove the main relationship row because that display join is left-joined.
  • lastEdited is returned as a SQL datetime converted from the stored Unix timestamp.
  • Unknown requested field names are silently omitted; id is always included.

See it in Fieldmotion

CRM1

Supplier cost/price screens query associations by supplier or stock ID and can toggle whether archived stock is included.

CRM2

Open the supplier price/cost adjustment list or a Stock item’s supplier controls. CRM2 calls this route and sends showInactiveStock=0 until the archived-stock option is enabled.

Related endpoints