Vehicles
Query the CRM1 Vehicles table
/a/Vehicles_getDT
Build the positional, server-paged vehicle table used by CRM1 Settings.
When to use this endpoint
Use Vehicles_getDT only for the legacy CRM1 DataTables contract. CRM2 uses Vehicles_getDataTable with mapped object rows.
Authentication and permissions
The request must establish an authenticated tenant database through signed API credentials or a CRM session. This legacy handler checks only for the tenant database prefix and does not call the normal user-login guard.
It performs no page or role-permission check.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
search | DataTables object | Yes | Must be present, but its value and global search text are ignored. |
draw | Integer-compatible | No | Echoed as an integer; defaults to 0 if absent. |
start / length | Integer-compatible | Effectively yes | SQL offset and page length. Missing values integer-convert to zero, so a missing length returns no data rows. |
order[0][column] | Integer-compatible | Effectively yes | Sort mapping is 0 registration, 1 cost, 2 price, and 3 description; other values fall back to registration. This mapping does not align with the returned hidden UUID column followed by registration. |
order[0][dir] | String | Effectively yes | Exact desc selects descending; every other value selects ascending. |
fReg / fDescription | String | No | Case-insensitive database substring filters when nonblank. |
fCostPerDistance / fPricePerDistance | Numeric-compatible | No | Exact decimal filters when present and not the empty string. Nonnumeric values convert to zero. |
Example request
$table = FM_api('Vehicles_getDT', [
'draw' => '4',
'start' => '0',
'length' => '25',
'order' => [['column' => '0', 'dir' => 'asc']],
'search' => ['value' => '', 'regex' => '0'],
'fReg' => '241-D',
]);
Example response
{
"recordsTotal": "18",
"recordsFiltered": "2",
"draw": 4,
"data": [["4ec721a4aa8f4ec393b6c66fd31bf611","241-D-12001","0.4200","0.7500","Service van",""]]
}
Errors and unusual responses
| Response | Condition |
|---|---|
{"error":"not logged in"} | No tenant database prefix is available. |
{"error":"missing or invalid parameter: search"} | The search key is absent, even though its content is unused. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Each data row is positional: UUID, registration, cost, price, description, and an empty action placeholder. The first value is not the numeric vehicle ID.
- The global DataTables search term is ignored; only the four
f*filters affect the query. recordsTotalcounts every vehicle andrecordsFilteredapplies the column filters. Vehicles have no deleted-state filter.
See it in Fieldmotion
CRM1
Open Settings → Vehicles in CRM1 and filter browser developer tools for the exact function name. Loading, filtering, sorting, or paging the table calls this endpoint.
CRM2
CRM2 uses Vehicles_getDataTable; no CRM2 caller for this legacy route was found.
Related endpoints
Vehicle_updatereceives the UUID from the first hidden column when CRM1 edits a row.Vehicle_setRegand the other legacy setters power inline edits.