Job types
Get a job type’s default duration
/a/JobType_getDuration
Read the default number of hours that job editors apply when this type is selected.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer string | Yes | Existing 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
| 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: 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-startandwork-day-enddetermine 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
JobType_setDurationstores this default with focused validation.JobType_getRequestedDetailscan returnmetaor other mapped fields.