我希望用户上传到我们的服务器,然后让我们的服务器使用 API 将文件上传到 Box 中的特定文件夹。我怎样才能做到这一点?我应该使用什么凭据?
curl https://app.box.com/api/oauth2/token \
-d 'grant_type=client_credentials&client_id=CLIENT_ID&client_secret=SECRET'
返回
{"access_token":"TOKEN","expires_in":3793,"restricted_to":[],"token_type":"bearer"}
curl https://upload.box.com/api/2.0/files/content \
-H "Authorization: Bearer TOKEN" -X POST -F \
file=@package.json -F folder_id=3306197480
返回
{"type":"error","status":404,"code":"not_found","context_info":{"errors":[{"reason":"invalid_parameter","name":"parent", "message":"无效值 'd_3306197480'。未找到值为 'd_3306197480' 的'父'"}]},"help_url":"http://developers.box.com/docs/#errors","message" :"未找到","request_id":"1157604954550c7c754b9c9"}