User accounts and profiles
Read a user’s vehicle reference
/a/User_getVehicle
Return the selected user’s vehicle ID and registration through a left join.
When to use this endpoint
Use when filling a Job form’s vehicle source from its assigned user. The result is a reference lookup, not the full vehicle record.
Authentication and permissions
Authenticate with signed API-key fields or a logged-in CRM session. Session requests use the dispatcher’s CSRF protection when configured; signed requests follow the API-key authentication flow.
The handler requires an authenticated tenant and adds no administrator, Users page or self-only permission check. This describes this legacy route; permissions enforced by other User update routes do not automatically apply here.
The dispatcher applies configured TeamAccess user-record scope before the handler. An explicit target outside that scope returns an error; omitted targets use the current user for the scope check. Active/deleted filtering and additional target checks are described below.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Integer string | Yes | Target user ID in the authenticated tenant. Parsed with intval; this is a single-record operation, with no pagination or sort controls. |
Example request
$result = FM_api('User_getVehicle', [
'id'=>'1042',
]);
Example response
{
"vehicle_id": "18",
"reg": "AB12 CDE"
}
Example IDs and registration are representative database strings. A missing user is the JSON boolean false, not a not-found object.
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": "invalid or missing parameter: id"} | id is omitted, null or converts below 1; wording differs from other User readers. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- Left joins the vehicle on the tenant user’s vehicle_id. A user with no matching vehicle still has a row with a nullable registration. A missing user returns false.
- Neither users nor vehicles are filtered by active/deleted status. The handler does not require a Vehicles or Users page permission.
- No collection filtering, pagination, ordering or batch result is provided. Parameters on this page describe the supported scalar/encoded input; malformed nested values are not a supported contract.
Side effects
- Read-only join; no cache changes or activity log.
See it in Fieldmotion
CRM1
In a CRM1 Job form, leave an auto-filled vehicle-source answer empty. pageJobForm requests User_getVehicle for the assigned user and uses reg.
CRM2
No direct production caller was found in CRM2. Its User layouts use the generic getRequestedDetails/updateData flow instead; do not assume that flow has the same validation or permissions as this legacy route.
Related endpoints
User_getCompanyName— Resolve an outsourcing company label.User_getMeta— Read one tenant metadata value.