Asset types
Create mapped asset-type data
/a/AssetType_createData
Create an asset type through the named field map used by configurable CRM2 layouts.
When to use this endpoint
Use AssetType_createData when saving CRM2’s configurable Asset Type create layout. For the stricter legacy create workflow with duplicate-name checking and shared-template propagation, use AssetType_new.
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 | No | Stored name. The field map does not mark it required and does not check uniqueness; an omitted name is allowed when another mapped field is present. |
meta | String or JSON-compatible value | No | Complete metadata value. Supplying an array/object stores its JSON encoding; a string is stored verbatim. |
attrs | Integer string | No | Complete attribute bitmask. CRM screens use bit 2 for Vehicle. |
rentalTypeID | Integer string | No | Stored as rental_type_id. The referenced value is not validated. |
metaURL | String | No | Writes meta.url, creating a metadata object when necessary. If both meta and metaURL are sent, field-map order makes metaURL the final URL value. |
lastEdited | Datetime string | No | Low-level mapped timestamp. When omitted, the helper writes the current server time. |
id | Any | No | Ignored during creation even though it appears in the map. |
Example request
$created = FM_api('AssetType_createData', [
'name' => 'Mobile Compressor',
'attrs' => '2',
'metaURL' => 'https://example.test/assets',
]);
Example response
{
"ok": 1,
"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 parameters."} | No writable mapped field is supplied. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Unknown request keys and
idare ignored. Layouthiddenandreadonlyflags are presentation metadata, not API write protection. - Integer fields are coerced with PHP integer conversion. Metadata paths are merged into the supplied or newly created metadata value.
- This endpoint performs one insert and has no filtering or pagination.
Side effects
- Inserts the row, invalidates the asset-type cache, and writes generic audit entries for accepted fields.
- It does not create a type-specific custom layout, merge shared custom fields, or send notifications.
See it in Fieldmotion
CRM1
No direct production CRM1 caller was found; CRM1 creates types with AssetType_new.
CRM2
Open Asset Types and create a type through the configurable create dialog. The shared layout registry maps that save to AssetType_createData.
Related endpoints
AssetType_updateDatais the matching mapped update.AssetType_getRequestedDetailsreads the same named field map.