【发布时间】:2015-05-06 19:33:06
【问题描述】:
** 更新:看起来我的问题可能是重复的。我已经为此工作了一天多一点,之前进行了一些繁重的搜索,但偶然发现了这个(Google Drive API call to insert Public Share permissions on Fusiontables causes Internal Error),这似乎表明这是 Fusion Tables 的驱动器权限的错误。目前,我想保持开放状态等待@pinoyyid 的回复。此外,鉴于我最近的发现,我希望知道是否应该关闭它或将其标记为重复。
我发现此资源记录了类似的工作流程,但不在 JavaScript 客户端 API 中:Set file sharing level to 'Anyone with the link' through Google Drive API
在尝试使用 JS 客户端 API 执行相同的过程时(请参阅下面的代码),我继续收到 500 的消息。我相信这个错误与我赋予value 键的值有关。我尝试了所有我能想象到的变化,但无济于事。非常感谢。
var request = gapi.client.drive.permissions.insert({
'fileId' : tracker_id,
'resource' : {
'value' : '',
'type' : 'anyone',
'role' : 'reader',
'withLink' : true,
},
});
request.execute(function(executed) { console.log(executed) });
更新:我刚刚发现这个帖子:Google Drive API: How do you insert permissions to make a document publicly readable?
看来该用户也可能一直在使用 JS 客户端 API...不幸的是,该问题/答案中发布的方法继续为我呈现 500 响应。如果有人碰巧知道原因,我将不胜感激。
【问题讨论】:
-
取出资源后面的逗号。'resource' : { 'value' : '', 'type' : 'anyone', 'role' : 'reader', 'withLink' : true, } // 这里如果你给逗号它需要一个参数。这应该可以解决您的问题。
-
谢谢@SGC,但这并不能解决问题。
标签: google-api google-drive-api google-api-client