For my application I need calculate available storage for each user.
I using About API(https://developers.google.com/drive/v2/reference/about/get) and following formula:
Free storage = (quotaBytesTotal - quotaBytesUsed)
It works well, except users without Extra storage. For such users quotaBytesUsed is more than quotaBytesTotal:
{"kind"=>"drive#user", "displayName"=>"D B", "isAuthenticatedUser"=>true},
"quotaBytesTotal"=>"5368709120",
"quotaBytesUsed"=>"26843545600",
"quotaBytesUsedAggregate"=>"26843545600",
"quotaBytesUsedInTrash"=>"0",
"largestChangeId"=>"363004",
Is this API bug?
How I can calculate free storage for such users?
I found reason of issue.
Our user bought +20GB of extra storage. He had 25GB of quota and almost all 25GB were used.
Last month payment subscription (for extra storage) was cancelled, and quota for this user was reduced to 5GB.
This is why
quotaBytesUsed > quotaBytesTotal