Assets
Export asset jobs
/a/Asset_exportJobs
Download jobs directly assigned or explicitly linked to one active asset as CSV.
When to use this endpoint
Use Asset_exportJobs for the export button on CRM1’s asset Jobs screen.
The response is a CSV download and the handler exits; successful output is not JSON.
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 |
|---|---|---|---|
aid | Integer string | Yes | Asset ID. Only jobs are returned when a non-deleted asset with this ID exists. |
search | String | No | Substring matched against job ID, tenant-local job date/time text, reference, assigned user ID, notes, or form name. A present blank string adds a match-all predicate. |
Example request
// Submit an authenticated POST/download request to /a/Asset_exportJobs:
[
'aid' => '4821',
'search' => 'annual service',
]
Example response
Job ID,Meeting Date,Job Ref,Description,User Name,Form,Notes,Status
7719,"2026-09-24 09:00:00",JOB-7719,"Annual service","Alex Morgan","Service Form","Completed successfully",Complete
The response has Content-Type: text/csv and attachment filename asset_jobs.csv. The exact legacy second-column header is retained in the file.
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: aid"} | aid is absent. A present zero produces a header-only CSV. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Qualifying jobs are non-deleted direct asset jobs or jobs associated through the legacy asset/job link table.
DISTINCTremoves duplicates between those paths. - Description is derived from the first asset-maintenance row with the job’s recurrence ID; when none is found it becomes
recurrence. One-off jobs have a blank description. - Notes contain the last item from the stored notes JSON array. The handler does not support older plain-text notes safely.
- Status names come from the tenant’s legacy
appointment-statusessetting. A missing index can produce warnings or an empty status. - The server writes
/tmp/<tenant>/tmp/asset_jobs.csv, overwrites that tenant filename, streams it, and leaves it in place.
Side effects
- Creates or replaces a tenant-scoped temporary CSV file. It does not modify jobs or assets.
See it in Fieldmotion
CRM1
Open an asset’s Jobs tab and select Export. The form supplies the asset ID and current table-search text.
CRM2
No direct production CRM2 caller was found.
Related endpoints
Asset_listJobsreturns a JSON list of direct job IDs only.