0
上傳文件和壞Requestwhen立即做permission->更新:
(400)使用許可庫谷歌的API的PHP客戶端
public function sharingFile() {
$fileId = $this->file['id'];
$permissionId = $this->file['userPermission']['id'];
try {
$permission = $this->service->permissions->get($fileId, $permissionId);
$permission->setRole('writer');
$permission->setType('default');
print_r($permission);
return $this->service->permissions->update($fileId, $permissionId, $permission);
} catch (Exception $e) {
return "Error: " . $e;
}
return NULL;
}
,並得到一個錯誤:
Error: exception 'Google_ServiceException' with message 'Error calling PUT
https://www.googleapis.com/drive/v2/files/0B6xE_F1PfpXTbF9IdHgxbEJueEk/permissions/me:
(400) Bad Request' in Z:\home\site.com\www\google-api-php-client\src\io\Google_REST.php:66
Stack trace:
#0 Z:\home\site.com\www\google-api-php-client\src\io\Google_REST.php(36): Google_REST::decodeHttpResponse(Object(Google_HttpRequest))
#1 Z:\home\site.com\www\google-api-php-client\src\service\Google_ServiceResource.php(186): Google_REST::execute(Object(Google_HttpRequest))
#2 Z:\home\site.com\www\google-api-php-client\src\contrib\Google_DriveService.php(774): Google_ServiceResource->__call('update', Array)
它可能是庫中的一個錯誤?
請幫忙。
分享和許可它不是一回事?在這種情況下,爲所有人做文件共享? – ne3Vubeki 2013-03-11 18:39:39
通過插入。鍵入「任何人」並將角色設置爲「讀者」 – ne3Vubeki 2013-03-11 19:23:44