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

ParameterTypeRequiredDescription
searchDataTables objectYesMust be present, but its value and global search text are ignored.
drawInteger-compatibleNoEchoed as an integer; defaults to 0 if absent.
start / lengthInteger-compatibleEffectively yesSQL offset and page length. Missing values integer-convert to zero, so a missing length returns no data rows.
order[0][column]Integer-compatibleEffectively yesSort 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]StringEffectively yesExact desc selects descending; every other value selects ascending.
fReg / fDescriptionStringNoCase-insensitive database substring filters when nonblank.
fCostPerDistance / fPricePerDistanceNumeric-compatibleNoExact 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

ResponseCondition
{"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.
  • recordsTotal counts every vehicle and recordsFiltered applies 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_update receives the UUID from the first hidden column when CRM1 edits a row.
  • Vehicle_setReg and the other legacy setters power inline edits.