Assets
Get recent asset jobs
/a/Assets_getRecentAppointments
Return the five most recent completed maintenance jobs linked to one asset through maintenance recurrences.
When to use this endpoint
Use Assets_getRecentAppointments for the maintenance-history popup on the legacy Assets list. Despite its legacy wire name, the records returned are jobs.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session. The handler requires login or an established tenant database context and performs no additional Asset-page or role-permission check unless the page says otherwise.
Every query and write uses the authenticated tenant’s tables. CRM1 and CRM2 may hide actions through client-side permissions that these collection routes do not repeat.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer-compatible | Yes | Positive asset ID. The endpoint does not separately verify that the asset row exists. |
Example request
$jobs = FM_api('Assets_getRecentAppointments', [
'id' => '4821',
]);
Example response
[
{
"asset": "4821",
"description": "Annual service",
"id": "7719",
"meeting_time_e": "1790845200",
"job_ref": "JOB-7719"
}
]
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 value is absent, zero, or integer-converts below one. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Only completed, non-deleted jobs whose customer is this asset and whose metadata recurrence ID matches an Asset Maintenance recurrence are returned. Other completed asset jobs are excluded.
- Rows are newest planned job time first and limited to five. The timestamp remains a database string containing a Unix epoch.
See it in Fieldmotion
CRM1
On Assets, choose history beside an asset’s last-maintenance cell. The dialog requests this route and renders Job Ref, Job Time, and Description.
CRM2
No direct production CRM2 caller was found; CRM2 uses mapped maintenance fields and tables.
Related endpoints
AssetMaintenance_getDTlists maintenance definitions.Assets_listJobsfinds job IDs overlapping a date range.