2016-04-19 41 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請求指定正確的版本號可能是遇到的錯誤可能的解決方案。

相關問題