0

查看将缓冲区上传到 Box。但我一直收到以下错误:

{ message: 'Bad request',type: 'error',details: [ { message: 'Unsupported document type.' } ] }

我的代码如下:

    var boxViewLib= require('box-view');
    var boxView =boxViewLib.createClient(process.env.BOX_KEY);

    var boxOptions = {
        params:{ name:'red.jpg'}       
        ,retry : true
    }
// the params.Body is a Buffer 
boxView.documents.uploadFile(params.Body, boxOptions, function(err, boxData) {
                                     console.log('Upload to Box View');
                                     console.log('Err '+ err);
                                     console.log( boxData);
});

回应是:

Upload to Box View
Err Error: Bad request
{ message: 'Bad request',
  type: 'error',
  details: [ { message: 'Unsupported document type.' } ] }
4

1 回答 1

0

您实际上是在尝试上传 JPEG 图像吗?View API 当前仅支持文档和文本文件(请参阅此处的完整列表:https ://developers.box.com/view/#filetypes )。

否则,您的代码看起来不错。

于 2015-02-23T19:23:46.197 回答