2016-02-26 901 views
0

我越來越從驅動API一個谷歌雲端硬盤API - 下載超過配額

The download quota for this file has been exceeded 

響應。我試圖通過以下網址簡單地下載文件:

String url = "https://www.googleapis.com/drive/v2/files/" + media.getId() + "?alt=media\n" 

我的文件是幾MB大,我只是不能下載它。我使用scribe和oauth2,我創建了一個請求,簽名併發送它。響應顯示我的標誌性作品,但我不知道爲什麼我總是從谷歌上面的錯誤響應...

其他像retireving我的所有文件的清單,我的用戶的工作只是罰款和工作多次...

回答

0

由於您使用的是Android,爲什麼不嘗試使用Java API客戶端調用它,如文檔的Download Files部分所述。

private static InputStream downloadFile(Drive service, File file) { 
    if (file.getDownloadUrl() != null && file.getDownloadUrl().length() > 0) { 
     try { 
      // uses alt=media query parameter to request content 
      return service.files().get(file.getId()).executeMediaAsInputStream(); 
     } catch (IOException e) { 
      // An error occurred. 
      e.printStackTrace(); 
      return null; 
     } 
    } else { 
     // The file doesn't have any content stored on Drive. 
     return null; 
    } 
} 

另一種替代方法是使用webContentLink來檢索下載URL。

希望這會有所幫助!

+0

我會檢查出來的Web內容的鏈接提示,謝謝。我不想使用API​​,我想在我的應用程序許多服務(最終極有可能超過10個),所以我用一個OAuth和的oauth2方法,並使用劃線庫......我不想Google api庫,Facebook api庫以及其他重要api庫在我的應用程序中保持較小...並且能夠重新使用幾乎所有數據源的所有數據源... – prom85

相關問題