Google Drive Rest Api Files export limitation

前端 未结 2 1277
情话喂你
情话喂你 2021-01-12 20:21

I use rest api \"https://www.googleapis.com/drive/v3/files/fileId/export\" \"reference page\" to get google Doc

I have document size ~ 5 MB when i try to get the fil

2条回答
  •  不要未来只要你来
    2021-01-12 21:20

    Instead of using this export endpoint you can request exportLinks field in the Files: list:

    curl \
      'https://www.googleapis.com/drive/v3/files/[FILE_ID]?fields=exportLinks' \
      --header 'Authorization: Bearer [ACCESS_TOKEN]' \
      --header 'Accept: application/json'
    

    That will return something like this (these are links I got for a Google Slides presentation):

    {
     "exportLinks": {
      "application/vnd.oasis.opendocument.presentation": "https://docs.google.com/feeds/download/presentations/Export?id=[FILE_ID]&exportFormat=odp",
      "application/pdf": "https://docs.google.com/feeds/download/presentations/Export?id=[FILE_ID]&exportFormat=pdf",
      "application/vnd.openxmlformats-officedocument.presentationml.presentation": "https://docs.google.com/feeds/download/presentations/Export?id=[FILE_ID]&exportFormat=pptx",
      "text/plain": "https://docs.google.com/feeds/download/presentations/Export?id=[FILE_ID]&exportFormat=txt"
     }
    }
    

    And those urls don't have such a hard size limit (I was able to get out ~50mb PDFs)

提交回复
热议问题