When to use this endpoint

Use Suppliers_getDataTable when reproducing CRM2’s Suppliers page or its filtered export selection. It exposes shared layout and data-table conventions.

For a smaller external contract prefer Suppliers_list or Suppliers_getById.

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 arrayYesMapped response field names. Available names are name, contactName, streetAddress1, streetAddress2, town, county, country, postcode, email, phone, notes, website, taxId, terms, accountNumber, refNumber, isActive, onHold, type, meta, createDate, lastEdited, editedUuid, accountsContact, accountsEmail, additionalEmail, and customValues. Unknown names are skipped and id is always added.
isTableInteger stringNoDefaults to table mode. Exact integer 0 returns only {"data":[...]} and enables optional limit.
draw, start, lengthInteger stringNoTable counter, zero-based offset, and page size. Defaults are 0, 0, and 10. Zero or negative page sizes are not rejected before SQL.
limitInteger stringNoPositive limit in non-table mode. Zero means no limit.
orderBy / orderDescMapped field / direction stringNoExplicit mapped sort. CRM sends asc or desc; the direction text is not separately allowlisted by this layer.
order[0][column] / order[0][dir]Integer / stringNoDataTables ordering fallback. The column is adjusted for the leading action column; exact desc selects descending.
searchValueStringNoCase-insensitive substring search across searchField or all mapped searchable fields.
searchFieldMapped field or native arrayNoField(s) used by searchValue; omission searches All.
advanceSearchNative arrayNoShared CRM2 condition objects using a mapped field, condition, value, and optional AND/OR choice.
referenceDate, dateFrom, dateToMapped field and integer day offsetsNoShared relative-date filtering in the tenant timezone. Both offsets are needed for the date range.
groupByNative arrayNoMapped fields to add to SQL grouping. Unknown names are ignored.
Mapped field filtersScalar or native arrayNoAny mapped field can filter. Text scalars use case-insensitive substring matching; numeric scalars use equality; arrays use IN.

Example request

$table = FM_api('Suppliers_getDataTable', [
	'fields' => ['id', 'name', 'accountNumber', 'email', 'onHold'],
	'draw' => '4',
	'start' => '0',
	'length' => '25',
	'searchField' => 'All',
	'searchValue' => 'northshore',
	'orderBy' => 'name',
	'orderDesc' => 'asc',
]);

Example response

{
  "data": [{"id":"488104","name":"Northshore Components","accountNumber":"NS-42","email":"orders@example.test","onHold":"0"}],
  "draw": 4,
  "recordsTotal": "42",
  "recordsFiltered": "1"
}

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"}fields is absent.
{"error":"error in database query"}A generated mapped/filter query fails.
Empty or broader-than-expected dataUnknown requested fields or malformed advanced-search items are silently ignored.

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

Behaviour and edge cases

  • Soft-deleted suppliers are always excluded. Inactive and on-hold suppliers remain unless explicitly filtered.
  • Table mode returns data, integer draw, and scalar counts. Non-table mode returns only data.
  • recordsTotal counts all non-deleted suppliers; recordsFiltered applies mapped, search, advanced, and date filters.
  • Mapped accounting fields are read from metadata JSON. customValues is decoded through the field map rather than returned as the raw stored string.
  • The endpoint has no Supplier-page permission check beyond authentication.

See it in Fieldmotion

CRM1

No CRM1 production caller was found. CRM1 uses Suppliers_getDT.

CRM2

Open Stock → Suppliers in CRM2 and filter browser developer tools for the exact function name. The shared display widget sends selected layout columns, search, filters, sorting, and paging to Suppliers_getDataTable.

Related endpoints