Assets
Print asset QR labels
/a/Assets_qrPrint
Render a printable HTML page of Asset QR labels for supplied IDs or the legacy filtered Asset list.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
ids | Native array or JSON array string | Yes | Asset IDs. An empty array selects every non-deleted Asset matching the optional filters. |
search / serial_number / name | String | No | Case-insensitive code/name or individual substring filters. |
type_id / owner_id | Integer-compatible | No | Exact type or owner filters. Zero owner omits the owner filter. |
location_id / location_type | Integers | No | Exact whereabouts pair when location ID is not -1. |
archived | Integer-compatible | No | Presence applies an exact archive-state filter. |
order[0][column] / order[0][dir] | Integer / string | No | Legacy 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
| Response | Condition |
|---|---|
{"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/error | A 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
Assets_listSomereturns compact details for a selected ID set.