Asset types
Import one legacy asset type
/a/AssetType_import
Insert one asset type from the retired flat CSV import shape.
When to use this endpoint
AssetType_import supports the old CRM1 comma-split importer. New integrations and both current import widgets should use AssetTypes_import.
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 |
|---|---|---|---|
val1 | Any | Yes | Legacy placeholder whose presence is required but whose value is never read. |
name | String | Yes | Asset-type name. Blank is rejected; the value is stored without trimming and duplicate names are allowed. |
val2 | Integer-like value | No | Legacy vehicle flag; omission becomes 0. The stored attrs value is 0 when false, otherwise intval(val2)+1. The intended values are 0 and 1, producing masks 0 and 2. |
Example request
$created = FM_api('AssetType_import', [
'val1' => '',
'name' => 'Mobile Compressor',
'val2' => '1',
]);
Example response
{
"id": 58
}
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: val1"} | The val1 key is absent, even though its value is unused. |
{"error":"no name given"} | name is absent, blank, or otherwise false-like. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- No duplicate-name check or trimming is performed.
- Values other than the intended
0/1vehicle flag can produce unusual attribute masks. - The inserted metadata is exactly
{},last_editedis current server time, and rental type uses its database default.
Side effects
- Inserts one type and invalidates the asset-type cache. It does not write an import-log row, generic audit entry, or shared-template merge.
See it in Fieldmotion
CRM1
The older Asset Types CSV reader references AssetType_import, but omits required val1. The current Import Types widget uses AssetTypes_import.
CRM2
No production CRM2 caller was found; CRM2 uses AssetTypes_import.
Related endpoints
AssetTypes_importis the current versioned multi-row importer.AssetType_newis the normal focused create route.