Assets
Export asset change history
/a/Asset_exportChanges
Download one asset’s recorded custom-field changes as a CSV file.
When to use this endpoint
Use Asset_exportChanges for the export button on CRM1’s asset History screen.
The route streams a file and terminates the request; it is not a JSON API response.
Authentication and permissions
The handler requires an authenticated tenant context, established by signed API-key fields or a CRM session. CRM1 posts its CSRF token as part of the logged-in form submission.
No page, role, or asset permission is checked by the handler.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
asset_id | Integer string | Yes | Positive asset ID. The handler does not verify that the asset exists or is non-deleted. |
search | String | No | Scalar substring matched against field name, new value, old value, or change date. Blank means all changes. |
Example request
// Use a normal authenticated POST/download client, not a JSON decoder.
// CRM1 submits a form to /a/Asset_exportChanges with:
[
'asset_id' => '4821',
'search' => 'pressure',
]
Example response
Date,User,Customer,"Job Time",Field,Value,"Value Was"
"2026-09-24 10:15:00","Alex Morgan","Northwind Service Centre","2026-09-24 09:00:00",pressure,42,39
The response has Content-Type: text/csv and attachment filename asset_changes.csv. All rows are ordered by change date ascending.
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: asset_id"} | asset_id is absent, zero, or otherwise not positive. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- The export applies the same scalar search categories as
Asset_changesGetDT, but it does not paginate and it omits field-templatehide_diffbehavior. - Job time is converted to tenant-local time. User and customer names are their current values and can be blank when the linked rows no longer exist.
- The server writes
/tmp/<tenant>/tmp/asset_changes.csv, overwrites that tenant filename on the next export, streams it, and does not remove it afterward.
Side effects
- Creates or replaces the tenant-scoped temporary CSV file on the CRM server. It does not modify asset or history records.
See it in Fieldmotion
CRM1
Open an asset’s History tab and select Export. The form carries the current table-search text.
CRM2
No direct production CRM2 caller was found.
Related endpoints
Asset_changesGetDTsupplies the paginated on-screen history.