Asset types
Update mapped asset-type data
/a/AssetType_updateData
Update one or more asset types through CRM2’s named field-map contract.
When to use this endpoint
Use AssetType_updateData for configurable CRM2 Asset Type edit layouts. It updates mapped columns and writes generic audit entries.
Use focused legacy setters only when their extra rules are required—for example, AssetType_setName checks duplicate names.
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 |
|---|---|---|---|
id | Integer string or array | Yes | Target ID or IDs. Scalar mode returns that row’s warning/error; array mode loops over IDs but always returns {"ok":1}, discarding each per-row result. |
name | String | No | Replacement name. Blank and duplicate values are accepted because the focused name validation is not called. |
meta | String or JSON-compatible value | No | Replaces complete metadata. Structured input is JSON-encoded. |
attrs / rentalTypeID | Integer strings | No | Replace the attribute bitmask and rental-type ID. Values are integer-converted and references are not validated. |
metaURL | String | No | Merges one value at meta.url. If meta is also supplied, this mapped field is applied afterward. |
lastEdited | Datetime string | No | Accepted by the map, but every changed update appends current server last_edited after mapped values, so callers cannot preserve their supplied timestamp. |
noRecord | Array | No | Mapped field keys whose generic audit entry should be marked hidden. It does not suppress the update. |
Example request
$result = FM_api('AssetType_updateData', [
'id' => '47',
'name' => 'Mobile Compressor',
'attrs' => '2',
'metaURL' => 'https://example.test/assets',
]);
Example response
{
"ok": 1
}
Scalar no-op input can return {"warning":"No Change."}; a missing row can return {"warning":"No data."}; only unknown update keys return {"warning":"no updated fields."}. Supplying only id returns {"ok":1}.
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: id"} | The id key is absent. |
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 are ignored. If no recognized fields remain, scalar mode returns a warning.
- Layout
readonly/hiddenflags are not API authorization. The route does not enforce unique names or validate rental types. - No custom-layout group or legacy-template merge occurs when metadata changes.
Side effects
- Changed rows receive current
last_edited, asset-type cache invalidation, and per-field generic audit entries. - The operation is not atomic across an ID array.
See it in Fieldmotion
CRM1
No primary production CRM1 save uses this route; CRM1 uses focused setters.
CRM2
Edit an Asset Type through the configurable edit dialog or main layout and inspect AssetType_updateData. The shared layout registry selects this update route.
Related endpoints
AssetType_createDatais the matching mapped create.AssetType_updateFieldapplies one map field to one or more IDs.