日本時間5月16日のContent Cloud Summitで、カスタムアプリにBox AI APIを活用する方法を紹介します。

詳細を表示

ユーザーを取得

get
https://api.box.com/2.0
/users/:user_id

企業内のユーザーに関する情報を取得します。

会社全体のユーザーを参照するには、アプリケーションと認証済みユーザーに適切な権限が付与されている必要があります。

また、このエンドポイントは、適切なスコープを持つ認証済みユーザー用として会社が所有するコンテンツでコラボレーションを行う外部ユーザーに対しては、一部の情報のみを返します。その場合、権限が与えられていないフィールドについては、nullが返されます。

リクエスト

bearer [ACCESS_TOKEN]
application/json

パスパラメータ

stringパス内必須
12345

ユーザーのID。

クエリパラメータ

string arrayクエリ内省略可能
id,type,name

レスポンスに含める属性のコンマ区切りリスト。このパラメータを使用すると、標準のレスポンスには通常含まれないフィールドをリクエストできます。

このパラメータを指定すると、明示的に指定しない限り標準フィールドはレスポンスに含まれず、リクエストしたフィールドのほかには、Mini版の表示のフィールドしか返されないことに注意してください。

レスポンス

application/jsonユーザー (Full)

1つのユーザーオブジェクトを返します。

使用可能なすべてのフィールドがデフォルトで返されるとは限りません。fieldsパラメータを使用して特定のフィールドを明示的にリクエストするには、fieldsクエリパラメータを使用します。

予期しないクライアントエラー。

get
ユーザーを取得
このドキュメント内で一部のAPIを試せるようになりました。
ログイン

リクエストの例

cURL
curl -i -X GET "https://api.box.com/2.0/users/12345" \
     -H "authorization: Bearer <ACCESS_TOKEN>"
.NET
BoxUser user = await client.UsersManager.GetUserInformationAsync(userId: "33333");
Java
String userID = "33333";
BoxUser user = new BoxUser(api, userID);
BoxUser.Info userInfo = user.getInfo();
Python
user_id = '33333'
user = client.user(user_id).get()
Node
client.users.get('33333')
    .then(user => {
        /* user -> {
            type: 'user',
            id: '33333',
            name: 'Example User',
            login: 'user@example.com',
            created_at: '2012-03-26T15:43:07-07:00',
            modified_at: '2012-12-12T11:34:29-08:00',
            language: 'en',
            space_amount: 5368709120,
            space_used: 2377016,
            max_upload_size: 262144000,
            status: 'active',
            job_title: 'Employee',
            phone: '5555555555',
            address: '555 Office Drive',
            avatar_url: 'https://app.box.com/api/avatar/deprecated' }
        */
    });
iOS
client.users.get(userId: "33333", fields: ["name", "login"]) { (result: Result<User, BoxSDKError>) in
    guard case let .success(user) = result else {
        print("Error getting user information")
        return
    }

    print("Got user \(user.name), with login \(user.login)")
}

レスポンスの例

{
  "id": "11446498",
  "type": "user",
  "address": "900 Jefferson Ave, Redwood City, CA 94063",
  "avatar_url": "https://www.box.com/api/avatar/large/181216415",
  "can_see_managed_users": true,
  "created_at": "2012-12-12T10:53:43-08:00",
  "enterprise": {
    "id": "11446498",
    "type": "enterprise",
    "name": "Acme Inc."
  },
  "external_app_user_id": "my-user-1234",
  "hostname": "https://example.app.box.com/",
  "is_exempt_from_device_limits": true,
  "is_exempt_from_login_verification": true,
  "is_external_collab_restricted": true,
  "is_platform_access_only": true,
  "is_sync_enabled": true,
  "job_title": "CEO",
  "language": "en",
  "login": "ceo@example.com",
  "max_upload_size": 2147483648,
  "modified_at": "2012-12-12T10:53:43-08:00",
  "my_tags": [
    "important"
  ],
  "name": "Aaron Levie",
  "notification_email": {
    "email": "notifications@example.com",
    "is_confirmed": true
  },
  "phone": "6509241374",
  "role": "admin",
  "space_amount": 11345156112,
  "space_used": 1237009912,
  "status": "active",
  "timezone": "Africa/Bujumbura",
  "tracking_codes": [
    {
      "type": "tracking_code",
      "name": "department",
      "value": "Sales"
    }
  ]
}