When to use this endpoint

Open Assets_qrPrint in a browser or iframe. It returns an auto-printing HTML document, not JSON.

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.

Parameters

ParameterTypeRequiredDescription
idsNative array or JSON array stringYesAsset IDs. An empty array selects every non-deleted Asset matching the optional filters.
search / serial_number / nameStringNoCase-insensitive code/name or individual substring filters.
type_id / owner_idInteger-compatibleNoExact type or owner filters. Zero owner omits the owner filter.
location_id / location_typeIntegersNoExact whereabouts pair when location ID is not -1.
archivedInteger-compatibleNoPresence applies an exact archive-state filter.
order[0][column] / order[0][dir]Integer / stringNoLegacy ordering. Only columns backed by the Assets table are reliable; see the warning.

Example request

// Open/submit in a browser because the response is HTML.
FM_api('Assets_qrPrint', [
	'ids' => json_encode([4821, 4822]),
]);

Example response

<!doctype html>
<html>
  <!-- printable labels containing each Asset name, code, and QR image -->
</html>

The response has text/html content type, loads the bundled QR JavaScript, creates one label per matching Asset, invokes printing, and exits.

Each QR value is the legacy URL http://q.fieldmotion.com/asset/<tenant>/<asset-id>. Asset name and code are HTML-escaped in the label.

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":"missing or invalid parameter: ids"}The ids key is absent; this check occurs before login enforcement.
PHP warning/errorA JSON ids value does not decode to an 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

  • Soft-deleted assets are excluded. An explicitly empty ID array means “all matching Assets,” not “none.”
  • The endpoint is read-only and unpaginated. A broad or empty selection can build a very large print document.

See it in Fieldmotion

CRM1

From Assets, select rows and open the QR print iframe. CRM1 calls this endpoint directly.

CRM2

No current production caller was found. CRM2 fetches Asset data and generates printable QR labels in the client.

Related endpoints