Google Drive API说实际上有些文件不存在 [英] Google Drive API says some files do not exist when in fact they do
问题描述
对不起,您请求的文件不存在。
请确保您具有正确的URL,并且文件的所有者尚未将其删除。
好的,文件当然不会被删除。我回复了我对文件列表的请求。我也可以通过普通的网络浏览器访问该文件。此外,该URL是正确的,因为这是API响应的那个。我的代码不处理在初始文件响应中返回的url。实际上,以下是用于获取工作表的网址:
https://spreadsheets.google.com/feeds / worksheets / {long key here} / private / full
所以,我的问题是为什么我的要求对于一些工作表回来后,回复工作表的实际列表,但在其他人(我可以访问,我知道存在)我得到错误的响应。
感谢,
Arie
我的应用使用OAuth 2.0,并且遇到了与新的Google表格相同的错误。修正了在OAuth的授权调用期间发送的范围参数中的更改,然后重新授权(重新启动OAuth流并获取新的令牌)。
直到现在,我的应用中的范围只是:
https://spreadsheets.google.com/feeds
code>
更新后的范围和问题解决方案:
https://spreadsheets.google.com/feeds https://docs.google.com/feeds
So, I've gotten to the point in my app where I can retrieve a list of spreadsheet documents from a user's Google Drive account by using the Google Spreadsheet API. I populate the file list in a ui control that users can click on to then retrieve the list of its worksheets. It's working as expected in some cases, but in others it is not. In my request, I use the url that comes back from the file list, and even so, the API responds with:
Sorry, the file you have requested does not exist.
Make sure that you have the correct URL and that the owner of the file hasn't deleted it.
Well, surely the file wasn't deleted. I got it back in the response to my request for the files list. I also can get to the file via a normal web browser. Also, the URL is correct because that's the one the API responded with. My code does not manipulate the url that comes back in that initial files response. In fact, here is the URL that is used to grab the worksheets:
https://spreadsheets.google.com/feeds/worksheets/{long key here}/private/full
So, my question is why does my request for some worksheets come back with a response with the actual list of worksheets, but on others (which I have access to, and I know exists) I get the faulty response.
Thanks, Arie
My app is using OAuth 2.0 and I ran into the same error with new Google Sheets. What fixed that was making a change in scope param sent during OAuth's authorize call and then reauthorising (reinitiating OAuth flow and obtaining new tokens).
Until now scope in my app was just:
https://spreadsheets.google.com/feeds
Updated scope and solution to the issue in my case:
https://spreadsheets.google.com/feeds https://docs.google.com/feeds
这篇关于Google Drive API说实际上有些文件不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!