When to use this endpoint

Use AssetTypes_export for CRM1’s Export Types button. It streams a file and terminates the request rather than returning JSON.

CRM2 uses AssetTypes_getExportData so users can choose and map fields.

Authentication and permissions

The handler requires an authenticated tenant context. CRM1 submits its CSRF token with the logged-in form post.

There is no explicit page, role, feature, or export permission check inside the handler.

Parameters

ParameterTypeRequiredDescription
assetTypeIDInteger stringNoPositive ID filter. Zero, blank, or omission selects every ID.
nameStringNoCase-insensitive substring filter over the stored name. Blank applies no filter.
attrsJSON arrayNoAttribute-mask values for an SQL IN filter. Invalid/empty JSON applies no attribute filter.

Example request

// Use an authenticated POST/download client, not a JSON decoder.
// CRM1 normally submits no filters to /a/AssetTypes_export.
[
	'assetTypeID' => '47',
	'name' => 'compressor',
	'attrs' => json_encode(['0', '2']),
]

Example response

"Asset Type ID",Name,,,"Is A Vehicle","QR Code Url"
47,Compressor,,,Yes,https://example.test/assets

The response has Content-Type: text/csv, attachment filename asset_types.csv, two deliberately blank header/data columns, and rows ordered by ID ascending.

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.

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

Behaviour and edge cases

  • Attribute masks 0/1 export as No, 2/3 as Yes, and all other masks as ?.
  • The QR URL is read from meta.url; missing or invalid metadata produces a blank value.
  • All matching rows are exported with no pagination or row limit.
  • The server writes /tmp/<tenant>/tmp/asset_types.csv, overwriting the tenant’s previous file with that name and leaving it in place after streaming.

Side effects

  • Creates or replaces a tenant-scoped temporary CSV file. No asset-type records are changed.

See it in Fieldmotion

CRM1

Open Assets → Setup Asset Types, choose Export Types, and inspect the form POST to AssetTypes_export. The production button sends no filters.

CRM2

No direct production CRM2 caller was found; CRM2 uses its mapped export workflow.

Related endpoints