2012-10-10 35 views

回答

2

對於V2 API,用戶可以調用上的GET /用戶,你會得到你自己回來。

{ 
    "total_count": 1, 
    "entries": [ 
     { 
      "type": "user", 
      "id": "13243406", 
      "name": "Robert Stark", 
      "login": "[email protected]", 
      "created_at": "2011-08-24T14:00:25-07:00", 
      "modified_at": "2012-10-10T04:32:24-07:00", 
      "role": "user", 
      "language": "en", 
      "space_amount": 53687091200, 
      "space_used": 48671461, 
      "max_upload_size": 104857600, 
      "tracking_codes": [], 
      "see_managed_users": false, 
      "sync_enabled": true, 
      "status": "active", 
      "job_title": "", 
      "phone": "", 
      "address": "", 
      "avatar_url": "https://api.box.com/api/avatar/large/13243406" 
     } 
    ] 
} 
+0

但是,如果當前用戶是企業管理員,會發生什麼情況?該文檔說這將返回企業中所有用戶的列表;我如何知道列表中的哪個用戶是主叫用戶?這是我無法輕鬆測試的。 –

+0

我們將很快添加一個方便的終端GET/users/me ...但它還沒有。 – Peter

+0

@dauphic確定whoami,目前我打電話/文件夾/ 0達到根文件夾,並通過created_by/owned_by獲取whoami – clsung

0

有關當前用戶的信息將在驗證過程中發生的get_auth_token調用中返回。見Step 4 under Authentication

<response> 
    <status>get_auth_token_ok</status> 
    <auth_token>yv9usmcmbnfhtx2y8rmlvk1csnoz65oo</auth_token> 
    <user> 
    <login>[email protected]</login> 
    <email>[email protected]</email> 
    <access_id>31313825</access_id> 
    <user_id>31313825</user_id> 
    <space_amount>5361200</space_amount> 
    <space_used>47477</space_used> 
    <max_upload_size>104800</max_upload_size> 
    <sharing_disabled/> 
    </user> 
</response> 
+0

我不一定要通過認證過程會;我可能正在使用已存儲在其他位置的身份驗證令牌。 –

1

您可以使用/ users/me端點來獲取有關當前用戶的信息。

get-the-current-users-information

curl https://api.box.com/2.0/users/me 
-H "Authorization: Bearer ACCESS_TOKEN" 
200 
{ 
    "type": "user", 
    "id": "17738362", 
    "name": "sean rose", 
    "login": "[email protected]", 
    "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/large/17738362" 
} 
相關問題