When to use this endpoint

Use JobTypes_getDT only for CRM1’s Job Types table or a client deliberately implementing its positional-row contract. CRM2 uses JobTypes_getDataTable.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler performs no additional page or role-permission check.

The lookup and any write use the authenticated tenant; an ID from another tenant cannot be addressed through this call.

Parameters

ParameterTypeRequiredDescription
startInteger stringYesZero-based result offset. It must integer-convert to zero or greater.
lengthInteger stringYesPage size after integer conversion. It must be at least 1; the handler imposes no maximum.
order[0][column]Integer stringYes0 sorts by ID; 1 sorts by name; every other value falls back to name.
order[0][dir]StringYesExact desc selects descending order; every other value selects ascending order.
drawInteger stringYesDataTables draw counter, returned after integer conversion.
nameStringNoTrimmed, case-insensitive substring filter on the job-type name. Blank input applies no filter.

Example request

$page = FM_api('JobTypes_getDT', [
	'start' => '0',
	'length' => '25',
	'order' => [['column' => '1', 'dir' => 'asc']],
	'draw' => '3',
	'name' => 'repair',
]);

Example response

{
  "draw": 3,
  "recordsTotal": "8",
  "recordsFiltered": "1",
  "data": [
    ["42", "Emergency repair", "4", "", [2, "dispatch@example.test"], "Default notes", 60, "{\"rate\":20}", "0", "18", "", "7"]
  ]
}

Each row is [id, name, priority, "", [send_notification, notification_email], notes, duration, tax_settings, archived, form_id, "", department]. Missing metadata values default to 0 or an empty string; stored tax settings remain encoded text.

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: start"}start is absent or negative.
{"error":"missing or invalid parameter: length"}length is absent or below 1.
{"error":"missing or invalid parameter: [order][0][dir]"}The nested direction is absent.
{"error":"missing or invalid parameter: [order][0][column]"}The nested column is absent.
{"error":"missing or invalid parameter: draw"}draw is absent.

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

Behaviour and edge cases

  • Both counts include archived rows; the name filter changes only recordsFiltered and the returned page.
  • Invalid or non-object metadata is treated as empty metadata for the derived notification, duration, and form values.
  • The endpoint accepts no general DataTables search value and has no tenant-setting-dependent columns.

See it in Fieldmotion

CRM1

Open Settings → Job Types, filter by name, sort, or change page. The table sends JobTypes_getDT; its UI offers a 500-row page size because this route has no cap.

CRM2

CRM2’s Job Types screen does not call this route; its shared configurable table derives JobTypes_getDataTable.

Related endpoints