GET /users
Request parameters
Parameter | Type | Description |
---|---|---|
userIds | array [string] | If provided only this user(s) will be returned. If not provided all user(s) which authenticated user is allowed to see will be retrieved. If id is provided which authenticated user is not allowed to see, then 401 code will be returned. |
organizationName | string | If provided only users which are assigned to this specific organizationName will be returned. If not provided all users within all organization units will be retrieved which authenticated user is allowed to see. If provided together with organizationId then organizationName will be ignored. If name is provided which authenticated user is not allowed to see, then 401 code will be returned. |
organizationId | string | If provided only users which are assigned to this specific organizationId will be returned. If not provided all users within all organization units will be retrieved which authenticated user is allowed to see. If id is provided which authenticated user is not allowed to see, then 401 code will be returned. |
roles | array [string] | Possible roles: "employee", "approver", "manager", "administrator", "main_administrator". If one or many are provided then only users with matching roles will be returned. |
inactive | boolean | If "true" is provided only inactive users will be returned. If "false" or nothing is provided only active users will be returned. Note: A user is inactive if the validTo date is in past. |
page | integer (default 1) | Decide which page should be returned. Note: Maximum of 20 users will be returned per page. |
Request example:
https://mctime.com/api/v2/auth/users
//All users which authenticated user is allowed to see will be returned.
https://mctime.com/api/v2/auth/users?userIds=123&userIds=456
//Users with id "123" or "456" will be returned if authenticated user is allowed to see them.
https://mctime.com/api/v2/auth/users?roles=employee
//All users which authenticated user is allowed to see and which have the "employee" role will be returned.
Responses
Code | Title | Description |
---|---|---|
200 | Success | Returned if request was successful. |
400 | Bad Request | Returned if request was bad. |
401 | Unauthorized | Returned if request was not authorized (eg. due to bad API key). |
404 | Not Found | Returned if request could not be found. |
Users permissions will be considered
The response will consider the permissions of the user who is authenticated by the API call and will only return users which user is allowed to see.
Response JSON example:
{
"items": [
{
"message": "Success",
"data": {
"users": [
{
"id": "123abc45-39c5-436f-a70b-d3a14db753c6",
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"mobilePhoneNumber": "+43123123"
},
{
"id": "987abc45-39c5-436f-a70b-d3a14db753c6",
"firstName": "Jane",
"lastName": "Doe",
"email": "[email protected]",
"mobilePhoneNumber": "+43987987"
}
],
"page": "1", //currently returned page
"pageSize": "15" //total number of pages
}
}
],
"valid": true
}