Departments
Retrieve department users
/a/Department_getUsers
Return the department row’s stored user-membership string.
When to use this endpoint
Use Department_getUsers when applying the legacy job editor’s optional department-based user filter.
Authentication and permissions
The request must authenticate with signed API-key fields or a logged-in CRM session. The handler performs no additional page or role-permission check.
The lookup and any write use the authenticated tenant; an ID from another tenant cannot be addressed through this call.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
departmentId | Integer string | Yes | Department ID after integer conversion; it must be greater than zero. The parameter is named departmentId, not id. |
Example request
$membership = FM_api('Department_getUsers', [
'departmentId' => '42',
]);
Example response
{
"users": "18,24"
}
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: departmentId"} | The parameter is absent or integer-converts below 1. This validation happens before the login check. |
false | No department row has the requested ID. |
Legacy application errors may be returned with HTTP 200. Check the decoded response for error, not only the HTTP status.
Behaviour and edge cases
- The response contains only the
userscolumn; it does not load user objects or remove inactive/non-login users. - There is no pagination, ordering, reciprocal-membership check, or additional permission gate.
See it in Fieldmotion
CRM1
Open a job, enable the department-user filter, and choose a department. CRM1 calls this route and intersects the returned IDs with its active-user list.
CRM2
The CRM2 Departments table reads the mapped users field instead; no direct CRM2 caller was found.
Related endpoints
Department_setUsersreplaces this membership and updates tenant user rows.Department_getreturns the full department row.