Developer Function: API: User Operation: Retrieve User (Select)
## Overview
You can use the API to retrieve user records.
## Preparation
Please [Create an API Key](/manual/api-key) before performing API operations.
## Request
Send json data in the following request format:
|Setting item|Value|
|:--|:--|
|HTTP Method|POST|
|Content-Type |application/json|
|Character Code|UTF-8|
|URL|http://{server name}/api/users/get (*1)|
|Body|See the json data below for reference|
(*1) Please edit the {server name} part to suit your environment as appropriate.
For pleasanter.net, the format is as follows:
https\://pleasanter.net/fs/api/users/get
### (a) When retrieving specific user information by user ID
##### JSON
```
{
"ApiVersion": 1.1,
"ApiKey": "sad610bHDo04720DoloA356...",
"View": {
"ColumnFilterHash": {
"UserId": "[11,12]"
}
}
}
```
The UserId filter is an array that allows multiple values to be specified, so please write it as shown above.
### (b) When retrieving user information that matches specified conditions
##### JSON
```
{
"ApiVersion": 1.1,
"ApiKey": "1ao3ea5kDH2335sar529UY...",
"View": {
"ColumnFilterHash": {
"DeptId": "[7,8]",
"Groups": "[1,2]",
"Gender": "[2]"
}
}
}
```
## Response
The json data in the following format will be returned for the number of selected UserIds. Please refer to [here](/manual/api-user) for the data layout (passwords cannot be obtained).
The following items will only be output when executed with the tenant administrator's API key.
|Output item|Display name on screen|
|:--|:--|
|LastLoginTime|Last login datetime|
|PasswordExpirationTime|Password expiration datetime|
|PasswordChangeTime|Password change datetime
|NumberOfLogins|Number of logins|
|NumberOfDenial|Number of failed logins|
|TenantManager|Tenant administrator|
|Disabled|Disabled|
|Lockout|Lock|
|LockoutCounter|Lock counter|
### (a) When executed with a tenant administrator's API key
##### JSON
```
{
"StatusCode": 200,
"Response": {
"Offset": 0,
"PageSize": 200,
"TotalCount": 1,
"Data": [
{
"TenantId": 12345,
"UserId": 12345,
"Ver": 1,
"LoginId": "hayato",
"GlobalId": "",
"Name": "Hayato Nakano",
"UserCode": "",
"Birthday": "2016-03-27T00:00:00",
"Gender": "",
"Language": "ja",
"TimeZone": "Tokyo Standard Time",
"DeptCode": "",
"DeptId": 0,
"Theme": "",
"Body": "",
"LastLoginTime": "2023-08-17T12:00:00",
"PasswordExpirationTime": "2023-08-31T12:00:00",
"PasswordChangeTime": "2023-06-02T12:00:00",
"NumberOfLogins": 100,
"NumberOfDenial": 5,
"TenantManager": false,
"Disabled": false,
"Lockout": false,
"LockoutCounter": 0,
"UserSettings": "{}",
"SecondaryAuthenticationCode": "",
"SecondaryAuthenticationCodeExpirationTime": "1899-12-30T00:00:00",
"LdapSearchRoot": "",
"SynchronizedTime": "1899-12-30T00:00:00",
"Comments": "[]",
"Creator": 2,
"Updator": 1,
"CreatedTime": "2023-04-01T12:00:00",
"UpdatedTime": "2023-08-15T12:00:00",
"MailAddresses": [
"webmaster@example.com",
"info@example.com"
],
"ApiVersion": 1.1,
"ClassHash": {
},
"NumHash": {
},
"DateHash": {
},
"DescriptionHash": {
},
"CheckHash": {
},
"AttachmentsHash": {
}
}
]
}
}
```
### (b) When executed with an API key other than that of the tenant administrator
##### JSON
```
{
"StatusCode": 200,
"Response": {
"Offset": 0,
"PageSize": 200,
"TotalCount": 1,
"Data": [
{
"TenantId": 12345,
"UserId": 12345,
"Ver": 1,
"LoginId": "hayato",
"GlobalId": "",
"Name": "Hayato Nakano",
"UserCode": "",
"Birthday": "2016-03-27T00:00:00",
"Gender": "",
"Language": "ja",
"TimeZone": "Tokyo Standard Time",
"DeptCode": "",
"DeptId": 0,
"Theme": "",
"Body": "",
"UserSettings": "{}",
"SecondaryAuthenticationCode": "",
"SecondaryAuthenticationCodeExpirationTime": "1899-12-30T00:00:00",
"LdapSearchRoot": "",
"SynchronizedTime": "1899-12-30T00:00:00",
"Comments": "[]",
"Creator": 2,
"Updator": 1,
"CreatedTime": "2023-04-01T12:00:00",
"UpdatedTime": "2023-08-15T12:00:00",
"MailAddresses": [
"webmaster@example.com",
"info@example.com"
],
"ApiVersion": 1.1,
"ClassHash": {
},
"NumHash": {
},
"DateHash": {
},
"DescriptionHash": {
},
"CheckHash": {
},
"AttachmentsHash": {
}
}
]
}
}
```
## Confirmation Items in Case of Error
[・Precautions when using the API and things to check if an error occurs](/manual/faq-api)
[・FAQ: What to check if modified configuration files or API requests (JSON format) are not recognized correctly](/manual/faq-json-format)
## Specification Changes
***API specifications have been partially changed since November 2018.**
- The URL format has been changed from '/pleasanter/api_items/xxxx' to '/pleasanter/api/items/xxxx'.
- The Content-Type specification has been changed from 'application/x-www-form-urlencoded' to 'application/json'.