Google文档/云端硬盘API不允许将新文档插入新的Google帐户 [英] Google Docs/Drive API does not permit a new document to be inserted into a new Google account

查看:129
本文介绍了Google文档/云端硬盘API不允许将新文档插入新的Google帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们发现Google Docs / Drive API的问题始终可以重现,并且似乎是几个星期前推出的一个新问题。要查看此问题,请按以下步骤操作:


  1. 创建一个全新的Google帐户,但不要在该帐户中执行任何操作(请勿点击在Drive上查看Google Drive) - 创建并关闭该窗口。
  2. 尝试通过Google Docs API插入新文档(我们使用Zend GData)或新的Google Drive API。

结果:使用旧的Google Docs API,出现错误预期响应代码200 400.无法转换文档(当我们只是创建一个新文档而没有上传某些内容时,这是没有意义的)。使用新的Google Drive API时,同样的问题会产生错误发生错误:调用POST googleapis.com/drive/v2/files时出错:(500)内部错误



这种情况会持续发生,直到我进入该新的Google帐户并点击云端硬盘进入Google云端硬盘。这样做可以为该用户初始化Google Drive,此时插入新文档的代码无任何问题。



这只是最近才开始发生的最近几周)。在这种情况下,相同的代码已经存在多年,没有任何问题。在学校设置中,如果管理员正在创建新的学生帐户(如Google Apps for Education帐户),则该问题在他们使用我们的服务时会频繁出现。这会被修复吗?有没有解决办法?帮助,谷歌API的人!

解决方案

一个快速的解决方法是:

添加到范围: https://www.googleapis.com/auth/drive.apps.readonly



在尝试创建新的doc,打电话列出已安装的应用程序 $ service-> apps-> listApps(); 或文件列表 $ service-> files-> listFiles();



试试看看它是否适用于您。


We have identified an issue with the Google Docs/Drive APIs that is consistently reproducible, and appears to be a new bug introduced a few weeks ago. To see the issue, follow these steps:

  1. Create a brand new Google account, but do NOT do anything in that account (do not click on Drive to view Google Drive) -- just create it and close that window.
  2. Attempt to insert a new (empty) document via the Google Docs API (we use Zend GData for that) or the new Google Drive API.

Result: With old Google Docs API, the error "Expected response code 200, got 400. Unable to convert document" is thrown (which is meaningless when we are just creating a new document, not uploading something). With the new Google Drive API, the same thing produces the error "An error occurred: Error calling POST googleapis.com/drive/v2/files: (500) Internal Error"

This continues to happen until I go into that new Google account and click "Drive" to enter Google Drive. Something about doing that "initializes" Google Drive for that user, at which point the code to insert the new document works without any issue.

This only started happening recently (within the last few weeks). The same code has been in place for years without any problem in this scenario. In a school setting, where an administrator is creating new student accounts (as Google Apps for Education accounts), this issue shows up very frequently as they use our service. Is this going to be fixed? Is there a work-around? Help, Google API folks!

解决方案

A quick workaround would be:

Add to scopes: https://www.googleapis.com/auth/drive.apps.readonly

Before trying to create new doc, make a call to list apps installed $service->apps->listApps(); or list of files $service->files->listFiles();

Try and see if this works for you.

这篇关于Google文档/云端硬盘API不允许将新文档插入新的Google帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆