When to use this endpoint

Use AssetTable_edit from the Asset Tables setup interface after choosing the table name, field IDs, labels, and input types. The caller supplies the definition ID even for a new table.

Authentication and permissions

The request must authenticate as a logged-in tenant user.

The handler requires client-admin status. Non-admin users receive only client admins can edit table attributes.

Parameters

ParameterTypeRequiredDescription
idInteger stringYesPositive definition key. CRM1 and CRM2 create IDs from the browser timestamp; the server does not allocate or collision-check them.
nameStringYesNonblank display name. Surrounding whitespace is removed before storage; no length or duplicate-name check is applied.
fieldsJSON arrayYesNonempty field-definition array. CRM sends objects such as {"id":1,"name":"Pressure","type":"text"}. The server does not validate individual IDs, names, types, options, or uniqueness.

Example request

$result = FM_api('AssetTable_edit', [
	'id' => '1700000000123',
	'name' => 'Inspection readings',
	'fields' => json_encode([
		['id' => 1, 'name' => 'Pressure', 'type' => 'text'],
		['id' => 2, 'name' => 'Inspected', 'type' => 'date'],
	]),
]);

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":"only client admins can edit table attributes"}The authenticated user is not a client administrator.
{"error":"missing or invalid parameter: id"}id is absent or not positive.
{"error":"missing or invalid parameter: name"}name is absent or trims to blank.
{"error":"missing parameter: fields"}The fields key is absent.
{"error":"invalid parameter: fields"}fields is not a nonempty JSON array.

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

Behaviour and edge cases

  • An existing key is replaced completely; a new key is appended to the decoded setting.
  • Changing or removing field definitions does not migrate stored row JSON. Old keys remain in data and newly configured keys may be absent.
  • The complete setting is deleted and recreated for each save, with no transaction around those two writes.

Side effects

  • Rewrites the tenant asset-tables setting and clears its cache. No row data, timestamp, or audit record is changed.

See it in Fieldmotion

CRM1

Open an asset’s Tables tab as a client admin, add a table or choose Edit Table Attributes, save, and inspect AssetTable_edit.

CRM2

Open an asset’s Tables area, add or edit a table definition, and inspect AssetTable_edit. CRM2 supports additional field metadata such as select options, which the server stores without validation.

Related endpoints