When to use this endpoint

Use Assets_getDataTable for CRM2-style Asset tables, selectors, or export selection. Use Assets_list for a smaller integration-oriented list.

Authentication and permissions

The request must authenticate with signed API-key fields or a logged-in CRM session. The handler requires login or an established tenant database context and performs no additional Asset-page or role-permission check unless the page says otherwise.

Every query and write uses the authenticated tenant’s tables. CRM1 and CRM2 may hide actions through client-side permissions that these collection routes do not repeat.

For non-client-admin users, the tenant permissions departmentBasedFilter and accountManagerBasedFilter on pageMain restrict assets through their owner customers. When both settings apply, both restrictions must match; an empty permitted-customer set returns no rows.

Parameters

ParameterTypeRequiredDescription
fieldsNative arrayNoNative array of mapped Asset fields. The endpoint appends id even when this parameter is omitted; unknown names are ignored.
isTableInteger-compatibleNoDefaults to DataTables mode. Exact integer 0 returns an unwrapped data array and permits the optional limit.
draw / start / lengthInteger-compatibleNoDataTables counter, zero-based offset, and page size. Defaults are 0, 0, and 10.
limitInteger-compatibleNoPositive maximum used only outside table mode; zero leaves the result unbounded.
orderBy / orderDesc or order[0]Mapped field / DataTables orderingNoSort controls accepted by the shared mapped-table helper. Unknown mapped names fall back to a selected field.
searchValue / searchFieldString / mapped field or arrayNoCase-insensitive substring search over selected mapped fields. searchField defaults to All.
referenceDate / dateFrom / dateToMapped date field / integer day offsetsNoRelative-date filtering in the tenant timezone. The offsets are relative to today, not date strings.
advanceSearchNative arrayNoShared advanced-filter clauses. Raw where expressions are an internal trusted-client mechanism, not a safe public integration feature.
owner / locationObject or array of objectsNoCRM2 selector values containing id. Owner ID -1 means unowned; location ID -1 means whereabouts not set. Supplying locationId with owner values changes the owner filter to “owned by or located at” those customer IDs.
childJobAndAssetBoolean-compatibleNoWith customer owner IDs, also includes their direct child customers when the list contains 0.
warrantyInOutArrayNoOR-combined warranty states: 1 is after today and 2 is today or earlier.
contractsArray of IDsNoSelects assets linked through the contracts metadata cache. See the legacy warning below.
nextDateStatusStringNodue selects next-service dates through today; dueSoon uses each asset’s amber service-frequency threshold.
ownedStringNoExact true selects assets whose owner customer has the tenant metadata flag owned=1.
hasFilesArrayNoA single 0 requires at least one file; a single 1 requires none. Selecting both applies no file filter.

Example request

$table = FM_api('Assets_getDataTable', [
	'fields' => ['id', 'name', 'code', 'owner', 'locationName', 'nextDate'],
	'draw' => '4',
	'start' => '0',
	'length' => '25',
	'searchField' => 'All',
	'searchValue' => 'compressor',
]);

Example response

{
  "data": [
    {
      "id": "4821",
      "name": "Compressor 4",
      "code": "CMP-004",
      "owner": {"id": "1042", "value": "Northwind Service Centre"},
      "locationName": "Plant Room",
      "nextDate": [{"id": "7712", "aid": "4821", "jobTime": "2027-01-01 09:00:00", "userID": "37", "jobRef": "JOB-7712"}]
    }
  ],
  "draw": 4,
  "recordsTotal": "240",
  "recordsFiltered": "1"
}

Available mapped fields are id, name, code, active, value, meta, lastEdited, cdate, typeID, locationID, locationType, location, locationName, ownerID, owner, appID, departments, archived, editedUuid, warranty, bookID, customQR, make, model, files, contacts, jobDetails, locID, and mapped metadata/custom fields. Additional mapped fields include metaServiceFrequency, metaLastVisited, metaLastServiced, metaNextDate, metaNextServiced, metaIsFlagged, metaCreditTerms, customValues, customMainValues, metaSkills, and contracts.

lastVisited returns {id, jobTime} with an epoch value. nextDate returns incomplete direct jobs with SQL date-time strings. allocatedToJob returns future/today incomplete jobs whose metadata names the asset.

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":"error in database query"}A mapped, advanced, or special filter produces a failing query.
Empty or unexpectedly broad dataUnknown mapped fields and unsupported filter values are generally ignored rather than rejected.

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

Behaviour and edge cases

  • Soft-deleted assets are excluded. Table mode returns data, draw, recordsTotal, and recordsFiltered; non-table mode returns only data and is unbounded unless limit is positive.
  • referenceDate=dateNext or lastVisited selects assets through qualifying non-deleted jobs in the relative date window. lastMaintenance joins recurrence history and can duplicate an asset when several maintenance rows match.
  • Owner- and account-manager-based restrictions use owner customers, not current whereabouts. Client administrators bypass both tenant settings.
  • Derived maintenance, last-visit, next-job, and allocation fields perform extra per-row queries and can be expensive on large pages. The allocation lookup does not exclude soft-deleted jobs.

See it in Fieldmotion

CRM1

No production CRM1 caller was found; CRM1 uses Assets_getDT.

CRM2

Open Assets, use Asset selectors, or run service-maintenance views. CRM2 supplies layout fields, filters, sorting, and pagination to this endpoint and uses non-table mode while collecting export IDs.

Related endpoints