I want to use the Google Drive API in my application. I signed up for a brand new Gmail address, went to the developers' console and created a project, and a service account for that project. I downloaded the credentials Json file, and added it to my project. I created a top-level Test folder for testing my code.
My code works fine, in that I can get a list of the folders and files, create new folders, upload files, etc.
If I go to the UI for Google Drive, I can see the files and folders (all but two files deleted to simplify debugging). ..
My Drive
- Test folder
- 20,480 byte Word file
- Subfolder
- 69 byte text file
If I look at the files and folders from my code (via the API), I can also see them all.
If I use the About API Explorer to see how much disk space I've used, the usage is shown as 20480, ie just the Word file. However, if I call the About API from my code, the usage is 69 bytes, ie just the text file. I'm puzzled why each method includes just one file, rather than both methods taking both into account.
A possible clue is if I look in the User.PermissionId property of the About object, I see different values when called from the API explorer and when called from my code. This makes me wonder if I'm using two different accounts. However, I don't see how that can be, because I only have the one service account for this Gmail account. If the service account were different from the main Gmail account, then I wouldn't expect to see the files and folders that my code created when I look in the Drive UI.
Anyone able to explain what is going wrong here? Thanks