Assets
Get CRM2 asset export data
/a/Assets_getAssetTableExportData
Run CRM2’s two-stage configurable Asset export, returning selected fields and Asset-table values under their requested keys.
When to use this endpoint
Use Assets_getAssetTableExportData only with CRM2’s Asset export widget. Call _ids=1 to select IDs, then request data for those IDs and fields.
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 |
|---|---|---|---|
_ids | String | Yes | Exact 1 starts selection. Otherwise supply a JSON array of numeric Asset IDs. |
fields | JSON array string | Data pass | Ordered fixed/custom/table fields to return. Unknown fixed names return an error. |
type_id / owner_id / location_id / location_type | Integer-compatible | Selection pass | CRM2 supplies these filters. Omitted keys are read directly by the legacy implementation and can generate PHP notices. |
search / asset_id / book_id / serial_number / name | String | No | Legacy selection-pass substring filters. |
warranty / whereabouts_not_set / archived | Mixed | No | Warranty, missing-whereabouts, and archive-state filters matching the CRM1 export conventions. |
referenceDateField / dateFromFilter / dateToFilter | String / local dates | No | CRM2 date filter. Only field names generated by the trusted Asset export UI should be used. |
Example request
$selection = FM_api('Assets_getAssetTableExportData', [
'_ids' => '1',
'type_id' => '0',
'owner_id' => '0',
'location_id' => '-1',
'location_type' => '0',
]);
$rows = FM_api('Assets_getAssetTableExportData', [
'_ids' => json_encode($selection['ids']),
'fields' => json_encode(['asset_id', 'asset_name', 'serviceFrequency']),
]);
Example response
{
"4821": {
"asset_id": "4821",
"owner_id": "1042",
"meta": "{...}",
"f0": "4821",
"f1": "Compressor 4",
"f2": "Every 12 Months"
}
}
The first pass returns {"ids":[...]}. Fixed fields use positional fN keys. Custom Asset values and the legacy colon/pipe Asset-table field syntax retain their request key; table matches are arrays of JSON strings.
serviceFrequency renders the stored interval as “Every N Day(s), Week(s), Month(s), or Year(s).” metaNextServiced and other supported metadata fields retain their stored scalar formats.
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: _ids"} | _ids is absent. |
{"error":"_ids should be a JSON array of numbers"} | The data-pass ID JSON is not numeric-array shaped. |
{"error":"fields should be a JSON array"} | The data-pass field list is invalid. |
{"error":"unknown field: ..."} | An unsupported fixed field is requested. |
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 endpoint is read-only and unpaginated. It can return a large ID set or data object.
- Its fixed-field transformations broadly mirror
Assets_getExportData, while adding CRM2 service-frequency metadata and its Asset-table field format. - The date-filter branches retain legacy field-name inconsistencies; consumers should reproduce the CRM2-generated request rather than inventing a reference field.
See it in Fieldmotion
CRM1
No production CRM1 caller was found; CRM1 uses Assets_getExportData.
CRM2
On Assets, start a configurable export. CRM2 first selects IDs with the active filters and then fetches the chosen columns through this route.
Related endpoints
Assets_getExportDatais the CRM1 equivalent and excludes deleted Assets.