Assets
Set an asset name
/a/Asset_setName
Replace an asset’s name after applying the tenant’s optional uniqueness rule.
When to use this endpoint
Use Asset_setName for an inline name edit on a known asset.
CRM1 prevents a blank value in its edit screens, but integrations must apply that rule themselves because this handler accepts blank.
Authentication and permissions
The handler requires an authenticated tenant context, established by signed API-key fields or a CRM session. It checks the tenant table prefix but does not separately require a logged-in user ID.
No page, role, or asset permission is checked.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer string | Yes | Server-side asset ID after integer conversion. The existence check includes soft-deleted assets. |
val | String | Yes | Replacement name after trimming. Blank is accepted by this setter. |
Example request
$result = FM_api('Asset_setName', [
'id' => '4821',
'val' => 'Compressor 4',
]);
Example response
{
"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":"no ID provided"} | id is omitted. |
{"error":"no val provided"} | val is omitted. A present blank value is accepted. |
{"error":"asset does not exist"} | No asset row has the converted ID. |
{"error":"An asset of that name already exists"} | The tenant setting asset-unique-name is enabled and another non-deleted asset has the same trimmed name. |
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 uniqueness check excludes the addressed ID and soft-deleted assets but includes archived assets.
- There is no no-change shortcut, and the endpoint can update a soft-deleted asset.
- This is a single-record mutation; it provides no list filtering or pagination.
Side effects
- Updates
nameandlast_edited, setsedited_uuidtoAsset_setName, invalidates the asset cache, and writes an asset audit entry.
See it in Fieldmotion
CRM1
Edit Name in the Assets table, customer Assets tab, or asset edit page and filter Network requests for Asset_setName. CRM1 blocks blank input and surfaces uniqueness errors.
CRM2
No direct production CRM2 call to Asset_setName was found; CRM2 uses its broader update contract.
Related endpoints
Asset_getreturns the stored name.Asset_newrequires a nonblank name and uses the same uniqueness setting.Asset_setCodechanges the serial number under its own optional uniqueness setting.