When to use this endpoint

Use AssetType_setAttrBit only when reproducing CRM1’s inline Vehicle toggle. The established call sends bit=2 and val=0 or 2.

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

ParameterTypeRequiredDescription
idInteger stringYesAsset-type ID. The type must exist.
bitInteger stringYesBit mask to clear from the existing attrs value before adding val. CRM uses 2.
valInteger stringYesInteger added after the requested bit is cleared. It is not normalized to zero or to bit; callers should send 0 or the same mask as bit.

Example request

$result = FM_api('AssetType_setAttrBit', [
	'id' => '47',
	'bit' => '2',
	'val' => '2',
]);

Example response

{
  "ok": 1
}

Errors and unusual responses

ResponseCondition
{"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 absent.
{"error":"no bit provided"}bit is absent.
{"error":"no val provided"}val is absent.
{"error":"asset_type does not exist"}The integer-converted ID is not found.

Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.

Behaviour and edge cases

  • If the current mask contains bit, that numeric mask is subtracted once; val is then added.
  • The endpoint does not treat unchanged input specially and always performs the update after validation.

Side effects

  • Updates attrs and current server last_edited, and invalidates the asset-type cache. It writes no generic audit entry.

See it in Fieldmotion

CRM1

On Assets → Setup Asset Types or the Asset Type edit page, change Is A Vehicle and inspect AssetType_setAttrBit.

CRM2

No direct production CRM2 caller was found. CRM2 saves attrs through AssetType_updateData.

Related endpoints