概要
User APIは、Fess のユーザーアカウントを管理するためのAPIです。 ユーザーの作成、更新、削除、権限設定などを操作できます。
ベースURL
/api/admin/user
エンドポイント一覧
| メソッド | パス | 説明 |
|---|---|---|
| GET/PUT | /settings | ユーザー一覧取得 |
| GET | /setting/{id} | ユーザー取得 |
| POST | /setting | ユーザー作成 |
| PUT | /setting | ユーザー更新 |
| DELETE | /setting/{id} | ユーザー削除 |
ユーザー一覧取得
リクエスト
GET /api/admin/user/settings
PUT /api/admin/user/settings
パラメーター
| パラメーター | 型 | 必須 | 説明 |
|---|---|---|---|
size | Integer | いいえ | 1ページあたりの件数(デフォルト: 20) |
page | Integer | いいえ | ページ番号(0から開始) |
レスポンス
{
"response": {
"status": 0,
"settings": [
{
"id": "user_id_1",
"name": "admin",
"surname": "Administrator",
"givenName": "System",
"mail": "admin@example.com",
"roles": ["admin"],
"groups": []
}
],
"total": 10
}
}
ユーザー取得
リクエスト
GET /api/admin/user/setting/{id}
レスポンス
{
"response": {
"status": 0,
"setting": {
"id": "user_id_1",
"name": "admin",
"surname": "Administrator",
"givenName": "System",
"mail": "admin@example.com",
"telephoneNumber": "",
"homePhone": "",
"homePostalAddress": "",
"labeledUri": "",
"roomNumber": "",
"description": "",
"title": "",
"pager": "",
"street": "",
"postalCode": "",
"physicalDeliveryOfficeName": "",
"destinationIndicator": "",
"internationaliSDNNumber": "",
"state": "",
"employeeNumber": "",
"facsimileTelephoneNumber": "",
"postOfficeBox": "",
"initials": "",
"carLicense": "",
"mobile": "",
"postalAddress": "",
"city": "",
"teletexTerminalIdentifier": "",
"x121Address": "",
"businessCategory": "",
"registeredAddress": "",
"displayName": "",
"preferredLanguage": "",
"departmentNumber": "",
"uidNumber": "",
"gidNumber": "",
"homeDirectory": "",
"roles": ["admin"],
"groups": []
}
}
}
ユーザー作成
リクエスト
POST /api/admin/user/setting
Content-Type: application/json
リクエストボディ
{
"name": "testuser",
"password": "securepassword",
"surname": "Test",
"givenName": "User",
"mail": "testuser@example.com",
"roles": ["user"],
"groups": ["group_id_1"]
}
フィールド説明
| フィールド | 必須 | 説明 |
|---|---|---|
name | はい | ユーザー名(ログインID) |
password | はい | パスワード |
surname | いいえ | 姓 |
givenName | いいえ | 名 |
mail | いいえ | メールアドレス |
telephoneNumber | いいえ | 電話番号 |
roles | いいえ | ロールID配列 |
groups | いいえ | グループID配列 |
レスポンス
{
"response": {
"status": 0,
"id": "new_user_id",
"created": true
}
}
ユーザー更新
リクエスト
PUT /api/admin/user/setting
Content-Type: application/json
リクエストボディ
{
"id": "existing_user_id",
"name": "testuser",
"password": "newpassword",
"surname": "Test",
"givenName": "User Updated",
"mail": "testuser.updated@example.com",
"roles": ["user", "editor"],
"groups": ["group_id_1", "group_id_2"],
"versionNo": 1
}
レスポンス
{
"response": {
"status": 0,
"id": "existing_user_id",
"created": false
}
}
ユーザー削除
リクエスト
DELETE /api/admin/user/setting/{id}
レスポンス
{
"response": {
"status": 0,
"id": "deleted_user_id",
"created": false
}
}
使用例
新規ユーザー作成
curl -X POST "http://localhost:8080/api/admin/user/setting" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "john.doe",
"password": "SecureP@ss123",
"surname": "Doe",
"givenName": "John",
"mail": "john.doe@example.com",
"roles": ["user"],
"groups": []
}'
ユーザーのロール変更
curl -X PUT "http://localhost:8080/api/admin/user/setting" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"id": "user_id_123",
"name": "john.doe",
"roles": ["user", "editor", "admin"],
"versionNo": 1
}'
参考情報
Admin API 概要 - Admin API概要
Role API - ロール管理API
Group API - グループ管理API
ユーザー - ユーザー管理ガイド