Search code examples
google-drive-api

Google Drive REST API Get file returns 404 with scope "drive.file" only


I'm using google drive REST API V3 to access the file. The basic api url is: https://www.googleapis.com/drive/v3/files/fileid

And the header contains key: Authorization with Bearer access token obtained from oauth.

However, if you create an normal google doc, this works. the response is:

{
"id": "1v3V0BWcWtYu_K9OLm1rffHA3vj5Bz8SY-0-JpU7CiEc",
"name": "test",
"mimeType": "application/vnd.google-apps.document",
"parents": [
    "0AP75Wn-e9WDqUk9PVA"
]
}

But if I created a google doc from google template, this returns 404. see below:

{
"error": {
    "errors": [
        {
            "domain": "global",
            "reason": "notFound",
            "message": "File not found: 14gHUCFTrwHaoZ88Kr0Qnn8OsUdzcU037GK7v-JI9L1I.",
            "locationType": "parameter",
            "location": "fileId"
        }
    ],
    "code": 404,
    "message": "File not found: 14gHUCFTrwHaoZ88Kr0Qnn8OsUdzcU037GK7v-JI9L1I."
}
}

Solution

  • After I requested more permissions, the problem solved. Nothing changed.