When to use this endpoint

Use MarketingSources_getDT only to reproduce the CRM1 Settings table. New integrations should use the compact list or mapped table endpoint.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler requires login but performs no additional Marketing-page, create, edit, delete, or role-permission check.

All reads and writes use the authenticated tenant’s tables. CRM1 and CRM2 hide some controls through client-side permissions; these routes do not repeat those UI checks.

Parameters

ParameterTypeRequiredDescription
drawInteger stringYesDataTables counter, integer-converted into the response.
startInteger stringEffectively yesZero-based SQL offset. It is read without a presence or nonnegative check.
lengthInteger stringEffectively yesSQL page size, read without validation.
order[0][column]Integer stringNo0 sorts by ID; 1 sorts by name; every other supplied value falls back to name. Omission defaults to ID.
order[0][dir]StringNoExact desc selects descending; omission or any other value selects ascending.
search[value]StringNoCase-insensitive substring across source name and textual ID.

Example request

$table = FM_api('MarketingSources_getDT', [
	'draw' => '2',
	'start' => '0',
	'length' => '25',
	'order' => [['column' => '1', 'dir' => 'asc']],
	'search' => ['value' => 'trade'],
]);

Example response

{
  "data": [["30124","Trade show",""]],
  "draw": 2,
  "recordsTotal": "12",
  "recordsFiltered": "1"
}

Each positional row is ID, name, and an always-empty action placeholder.

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: draw"}draw is absent.
Invalid SQL or empty dataNegative/missing pagination values produce a query the database rejects; the handler does not validate them.

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

Behaviour and edge cases

  • recordsTotal counts all sources; recordsFiltered applies search before pagination.
  • No active/deleted filtering exists for this table.
  • There is no stable secondary sort for tied names.

See it in Fieldmotion

CRM1

Open Settings → Marketing → Source in CRM1 and filter browser developer tools for the exact function name. Loading, sorting, searching, or paging the table calls MarketingSources_getDT.

CRM2

CRM2 uses MarketingSources_getDataTable for its mapped Lead Source page.

Related endpoints