[英]How to display current storage used in service account with Google Drive API using PHP?
請問如何顯示我的Google Drive API的服務帳戶中使用的當前存儲空間?
我試圖在字段中調用它,但它不起作用。
$parameters['fields'] = 'files(storage), nextPageToken';
通過鍵入標題,我似乎無法在此處找到帖子,但我找不到任何帖子。
使用 Drive API 的“About: get”怎么樣? 當這反映到使用 googleapis for PHP 的 PHP 腳本時,它變為如下。
$service = new Google_Service_Drive($client); // Please use your "$client".
$res = $service->about->get(['fields' => 'storageQuota']);
$storageQuota = $res -> getStorageQuota();
print_r($storageQuota);
// When you want to retrieve the value of "usage` of "storageQuota", you can do it as follows.
$usage = $storageQuota -> getUsage();
echo $usage;
運行上述腳本時,將獲得以下值。
{
"limit": "###",
"usage": "###",
"usageInDrive": "###",
"usageInDriveTrash": "###"
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.