2016-04-19 130 views
1

我试图用Drive Api下载文件,并且遇到了一些麻烦。我阅读本指南downloading file with Drive Api v3,并使用此代码Java Google Drive API下载文件

String fileId = "0BwwA4oUTeiV1UVNwOHItT0xfa2M"; 
OutputStream outputStream = new ByteArrayOutputStream(); 
driveService.files().get(fileId).executeMediaAndDownloadTo(outputStream); 

每当我收到此错误`

com.google.api.client.http.HttpResponseException: 400 Bad Request 
{ 
"error": { 
    "errors": [ 
    { 
    "domain": "global", 
    "reason": "badRequest", 
    "message": "Bad Request" 
    } 
    ], 
    "code": 400, 
    "message": "Bad Request" 
} 
}` 

回答

0

Errors and suggested actions

遇到错误意味着必填字段或参数尚未提供,提供的值无效,或提供的字段组合无效。

尝试将重复的父级添加到Drive项目时可能会引发此错误。当试图添加一个可以在目录图中创建一个循环的父代时,它也会被抛出。

你也可以尝试在建议的解决方案Google API for Google Docs, requesting a list of documents — 400 Bad Request其中,在您的HTTP GET请求指定正确的版本号可能是遇到的错误可能的解决方案。

相关问题