ユーザーを作成

post
https://api.box.com/2.0
/users

会社内の管理対象ユーザーを新規に作成します。このエンドポイントを使用できるのは、適切な管理者権限を持つユーザーとアプリケーションのみです。

リクエスト

bearer [ACCESS_TOKEN]
application/json

クエリパラメータ

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

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

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

リクエスト本文

string本文内省略可能
"900 Jefferson Ave, Redwood City, CA 94063"255

ユーザーの住所

boolean本文内省略可能
true

ユーザーが自身の連絡先リストで会社の他のユーザーを参照できるかどうか

string本文内省略可能
"my-user-1234"

ユーザーの検索に使用できる、アプリユーザーの外部識別子。これを使用して、外部IDプロバイダのユーザーIDをBoxユーザーに結び付けることができます。

boolean本文内省略可能
true

会社のデバイス制限からユーザーを除外するかどうか

boolean本文内省略可能
true

ユーザーが2要素認証を使用する必要があるかどうか

boolean本文内省略可能
true

ユーザーが社外のユーザーとのコラボレーションを許可されているかどうか

boolean本文内省略可能
true

ユーザーがアプリユーザーであることを示します。

boolean本文内省略可能
true

ユーザーがBox Syncを使用できるかどうか

string本文内省略可能
"CEO"100

ユーザーの役職

string本文内省略可能
"en"

修正版のISO 639-1形式で表されるユーザーの言語。

string本文内省略可能
"boss@box.com"

ユーザーがログインに使用するメールアドレス

is_platform_access_onlytrueに設定されている場合を除いて必須です。

string本文内必須
"Aaron Levie"50

ユーザーの名前

string本文内省略可能
"6509241374"100

ユーザーの電話番号

string本文内省略可能
"user"

ユーザーの会社ロール

次の値のいずれか1つ: coadmin,user

integer / int64本文内省略可能
11345156112

ユーザーが利用可能な容量の合計 (バイト数)。これを-1に設定するとストレージ容量が無制限になります。

string本文内省略可能
"active"

ユーザーのアカウントのステータス

次の値のいずれか1つ: active,inactive,cannot_delete_edit,cannot_delete_edit_upload

string / timezone本文内省略可能
"Africa/Bujumbura"

ユーザーのタイムゾーン

object array本文内省略可能

追跡コードを使用すると、管理者は管理コンソールからレポートを生成し、特定のグループのユーザーに属性を割り当てることができます。この設定を使用するには、会社に対して有効にしておく必要があります。

string本文内省略可能
"tracking_code"

tracking_code

次の値に固定: tracking_code

string本文内省略可能
"department"

追跡コードの名前。管理コンソールであらかじめ設定しておく必要があります

string本文内省略可能
"Sales"

追跡コードの値

レスポンス

application/jsonユーザー (Full)

新しく作成されたユーザーのユーザーオブジェクトを返します。

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

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

リクエストの例

cURL
curl -i -X POST "https://api.box.com/2.0/users" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -H "content-type: application/json" \
     -d '{
       "login": "ceo@example.com",
       "name": "Aaron Levie"
     }'
.NET
var userParams = new BoxUserRequest()
{
    Name = "Example User",
    Login = "user@example.com"
};
BoxUser newUser = await client.UsersManager.CreateEnterpriseUserAsync(userParams);
Java
BoxUser.Info createdUserInfo = BoxUser.createEnterpriseUser(api, "user@example.com", "A User");
Python
new_user = client.create_user('Temp User', 'user@example.com')
Node
client.enterprise.addUser(
	'eddard@winterfell.example.com',
	'Ned Stark',
	{
		role: client.enterprise.userRoles.COADMIN,
		address: '555 Box Lane',
		status: client.enterprise.userStatuses.CANNOT_DELETE_OR_EDIT
	})
	.then(user => {
		/* user -> {
			type: 'user',
			id: '44444',
			name: 'Ned Stark',
			login: 'eddard@winterfell.example.com',
			created_at: '2012-11-15T16:34:28-08:00',
			modified_at: '2012-11-15T16:34:29-08:00',
			role: 'coadmin',
			language: 'en',
			timezone: 'America/Los_Angeles',
			space_amount: 5368709120,
			space_used: 0,
			max_upload_size: 2147483648,
			status: 'active',
			job_title: '',
			phone: '',
			address: '555 Box Lane',
			avatar_url: 'https://www.box.com/api/avatar/large/deprecated' }
        */
	});
iOS
client.users.create(login: "new.user@example.com", name: "New User") { (result: Result<User, BoxSDKError>) in
    guard case let .success(user) = result else {
        print("Error creating user")
        return
    }

    print("Created 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"
    }
  ]
}