using the v2 box api: how do I get a user id

一世执手 提交于 2019-12-11 23:48:23

问题


I want to add a collaboration using the v2 api - but it requires a user id. How do I get the user id if all I have is the login name?


回答1:


When adding a collaborator, you can send either the user id or the user's email address:

i.e. both

curl https://api.box.com/2.0/collaborations \-H "Authorization: Bearer ACCESS_TOKEN" \
-d '{"item": { "id": "FOLDER_ID", "type": "folder"}, "accessible_by": { "id": "USER_ID"}, "role": "editor"}' \
-X POST

and

curl https://api.box.com/2.0/collaborations \-H "Authorization: Bearer ACCESS_TOKEN" \
-d '{"item": { "id": "FOLDER_ID", "type": "folder"}, "accessible_by": { "login": "USER_EMAIL"}, "role": "editor"}' \
-X POST

will work. In the case of the second example, the user doesn't have to have a Box account.

http://developers.box.com/docs/#collaborations-add-a-collaboration



来源:https://stackoverflow.com/questions/14046216/using-the-v2-box-api-how-do-i-get-a-user-id

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!