Tag: box api

Box Api – 如何获取谁评论一个文件的用户细节

我有Box Box中使用Box Api评论文件的场景。 我已经使用Box api添加评论。 显示所有评论时,显示与所有评论相同的评论者姓名。 我应该如何添加评论来区分谁使用Box API对其进行了评论 示例评论列表: { "type": "comment", "id": "1111", "is_reply_comment": false, "message": "Sample Comment 1", "created_by": { "type": "user", "id": "111", "name": "AAA", "login": "aaa@aaa.com" }, "created_at": "2016-08-11T00:01:56-07:00", "item": { "id": "78110824178", "type": "file" }, "modified_at": "2016-08-11T00:01:56-07:00" } { "type": "comment", "id": "2222", "is_reply_comment": false, "message": "Sample Comment 2", "created_by": […]

节点JS – 构造一个OAuth2请求

我试图构build一个OAuth2请求的框API。 他们给出的示例POST请求作为指导对我来说有点模糊,因为我最近学习了后端开发。 示例如下: POST /token Content-Type: application/x-www-form-urlencoded grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer& assertion=<JWT>& client_id=<client_id>& client_secret=<client_secret> 官方文档: https : //box-content.readme.io/docs/app-auth 我试图做到这一点的方式如下: var boxHeaders = { 'Content-Type': 'application/x-www-form-urlencoded' }; var boxOptions = { url: 'https://api.box.com/oauth2/token', method: 'POST', headers: boxHeaders, form: { 'grant_type': 'urn:ietf:params:oauth:grant-type:jwt-bearer', 'assertion': boxtoken, 'client_id': 'myclientid', 'client_secret': 'myclientsecret' } }; request.post(boxOptions, function(err, response, body) { console.log(body); }); 我得到以下错误: { "error":"invalid_request", […]

使用Node.js将文件从string上传到Box API

我正在使用Box的API版本2并尝试上传文件。 我有Oauth 2所有的工作,但我无法实际上传。 我正在使用Node.js和Express,以及“请求”模块。 我的代码看起来像这样: request.post({ url: 'https://upload.box.com/api/2.0/files/content', headers: { Authorization: 'Bearer ' + authToken }, form: { filename: ????, parent_id: '0' } }, function (error, response, body) { // … }); 现在,我试图上传到根文件夹,如果我理解正确,具有“0”的ID。 我真的不知道的是什么值给“文件名”。 我没有一个真正的文件来读取,但我有一个冗长的string表示我想上传的文件内容。 我应该如何上传这个“文件”?