Asset types
Retrieve asset types by ID
/a/AssetTypes_getById
Fetch a deduplicated batch of asset types by ID with an optional restricted field selection.
When to use this endpoint
Use AssetTypes_getById after another response supplies asset-type IDs. CRM1 and CRM2 object caches aggregate nearby requests into one call to this endpoint.
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 |
|---|---|---|---|
ids | JSON array or array | Yes | Requested IDs. Values are integer-converted and deduplicated while preserving first occurrence for query construction; result order is still not guaranteed. |
fields | JSON array or array | No | Allowlisted fields: id, name, meta, last_edited, and attrs. Defaults to all five. Unknown and duplicate names are removed; no valid selection returns an error. |
Example request
$types = FM_api('AssetTypes_getById', [
'ids' => json_encode(['47', '58']),
'fields' => json_encode(['id', 'name', 'attrs']),
]);
Example response
[
{"id": "47", "name": "Compressor", "attrs": "2"},
{"id": "58", "name": "Mobile Compressor", "attrs": "2"}
]
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"} | The ids key is absent. |
{"error":"no fields selected"} | fields is supplied but contains no allowlisted name or is not a decoded array. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Missing IDs are omitted rather than represented with null placeholders. An empty/malformed ID list is not cleanly validated and can produce a database error or warnings.
- There is no
ORDER BY; callers must index results by ID rather than relying on request order. metaremains a JSON string.rental_type_idand derivedmetaURLare not in the allowlist.- The batch has no pagination or maximum size in the handler.
See it in Fieldmotion
CRM1
Open any CRM1 view that renders an AssetType object label and inspect the aggregated AssetTypes_getById request in Network tools.
CRM2
CRM2’s shared AssetType object cache uses the same aggregated call when resolving type records by ID.
Related endpoints
AssetTypes_getNamesis the narrower ID/name lookup used by pickers and exporters.AssetType_getRequestedDetailsexposes the full named map and exact filters.