When to use this endpoint

Use JobType_getDuration when only the duration default is needed. Use JobType_getRequestedDetails when loading several mapped fields together.

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
idInteger stringYesExisting job-type ID.

Example request

$duration = FM_api('JobType_getDuration', [
	'id' => '42',
]);

Example response

{
  "ok": 1,
  "duration": 2.5
}

duration is the raw decoded meta.duration value. The focused setter stores an integer or float, but low-level metadata writes can leave another JSON type. Missing or unusable metadata returns numeric 0.

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: id"}The integer-converted ID is less than one.
{"error":"job type does not exist"}No row matches the ID.

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

Behaviour and edge cases

  • Values written through the supported CRM workflow are measured in hours. CRM1 and CRM2 convert them into days, hours, and quarter-hours for display.
  • Tenant settings work-day-start and work-day-end determine how the CRM screens translate hours into “days”; they do not change this endpoint’s value.
  • There is no filtering, ordering, or pagination.

See it in Fieldmotion

CRM1

No direct production CRM1 caller was found. The Job Types screen receives duration inside JobTypes_getDT, and the job editor reads the full type through JobTypes_getById.

CRM2

No direct production CRM2 caller was found. CRM2 reads mapped metadata for the table and job editor instead.

Related endpoints