Google Drive Approvals are now out of beta and allow for a user to request one or more other parties to approve/reject a document, then lock it as non-editable. Is there a way to do this via the Google Drive/Google Docs/Google Slides API, or do you have to use the Web GUI?
Asked
Active
Viewed 845 times
3
-
1Upon further research, there are no documentations yet from the official [Drive API](https://developers.google.com/drive/api/v3/reference) or [Google Docs API](https://developers.google.com/docs/api/reference/rest) that you can manage & control the **Request approval** feature. It seems like this is only available & accessible via the web UI. Perhaps it may be better to request this as a [missing feature](https://developers.google.com/drive/api/v3/support#missing_features) for the Drive API. – SputnikDrunk2 Nov 18 '21 at 21:00
-
I have created a new issue in the Issue Tracker. https://issuetracker.google.com/issues/208025958 – xd1936 Nov 29 '21 at 15:24
1 Answers
1
I have found a workaround to know if a document is approved or not (unfortunately not to start an approval flow):
- Open the document you want to start approval;
- Click File > Approval > Start new Approval flow, select option "Lock file before sending approval request"
- Call API /drive/v3/files/:fileId?fields=contentRestrictions, the response will look like this:
{
"contentRestrictions":[
{
"readOnly":true,
"restrictingUser":{
"kind":"drive#user",
"displayName":"........",
"me":true,
"permissionId":"........",
"emailAddress":".........."
},
"restrictionTime":"2022-04-27T11:03:42.430Z",
"type":"globalContentRestriction"
}
]
}
- Back to the document, make the approval, and file will be locked.
- Call again API /drive/v3/files/:fileId?fields=contentRestrictions, and now the response response will look like this:
{
"contentRestrictions":[
{
"readOnly":true,
"reason":"Locked for File Approval",
"restrictingUser":{
"kind":"drive#user",
"displayName":"......",
"me":true,
"permissionId":".......",
"emailAddress":"........"
},
"restrictionTime":"2022-04-27T10:54:24.594Z",
"type":"globalContentRestriction"
}
]
}
The difference is in the "reason" field, "Locked for File Approval" means that the file was approved.
P.S.: I don't how trustable this workaround is, I tested several and it seems consistent.
P.S.: I don't know if there is a better way to do it, just could find this one at the moment

Fabrizio Marmitt
- 11
- 1