Asset types
Create an asset type
/a/AssetType_new
Create a uniquely named asset type and apply the tenant’s legacy shared custom-field template when configured.
When to use this endpoint
Use AssetType_new for the CRM1 Asset Types create dialog and other workflows that need case-insensitive duplicate-name protection.
CRM2’s configurable create dialog uses AssetType_createData, which has different validation and side effects.
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 |
|---|---|---|---|
name | String | Yes | New type name. Blank/false-like input is rejected. Duplicate comparison and storage both use the trimmed value, ignoring case for the comparison. |
Example request
$created = FM_api('AssetType_new', [
'name' => 'Mobile Compressor',
]);
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":"no name given"} | name is absent, blank, or otherwise false-like. |
{"error":"Duplicate asset type name."} | A type with the same trimmed name exists, ignoring case. |
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 new row starts with metadata
{}; attribute and rental-type values use database defaults. - Duplicate detection has no deleted/status exception because asset types are hard-deleted and have no status columns.
- The shared setting is only applied when truthy. A blank setting leaves the new type without a legacy template.
Side effects
- Inserts one type, sets current server
last_edited, and invalidates the asset-type cache. - With the shared-template setting enabled, can also replace shared fields and refresh timestamps on every type. No generic audit entries are written.
See it in Fieldmotion
CRM1
Open Assets → Setup Asset Types, choose Create, enter a name, and inspect AssetType_new. CRM1 also uses it from the inline new-type option while editing an asset.
CRM2
The main CRM2 Asset Types create dialog does not call this route; it uses the mapped create endpoint. Other tested setup flows use AssetType_new as a simple fixture/create contract.
Related endpoints
AssetTypes_mergeSharedCustomTemplateexplains the account-wide legacy template rewrite.AssetType_clonestarts from another type’s legacy metadata instead.