Marketing
Query the CRM1 Lead Source table
/a/MarketingSources_getDT
Return CRM1’s paged positional Lead Source table with name/ID search and sorting.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
draw | Integer string | Yes | DataTables counter, integer-converted into the response. |
start | Integer string | Effectively yes | Zero-based SQL offset. It is read without a presence or nonnegative check. |
length | Integer string | Effectively yes | SQL page size, read without validation. |
order[0][column] | Integer string | No | 0 sorts by ID; 1 sorts by name; every other supplied value falls back to name. Omission defaults to ID. |
order[0][dir] | String | No | Exact desc selects descending; omission or any other value selects ascending. |
search[value] | String | No | Case-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
| Response | Condition |
|---|---|
{"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 data | Negative/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
recordsTotalcounts all sources;recordsFilteredapplies 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
MarketingSources_getDataTableis CRM2’s mapped table route.MarketingSources_listis the lightweight unpaged selector feed.