I believe your goal as follows.
- You want to retrieve all Google Document files using the method of "documents.get" in Google Docs API.
- You have no Document IDs of all Google Document files. You are required to retrieve the Document ID.
In order to achieve your goal, I would like to propose to use the following 2 processes.
Retrieve Document IDs of Google Document files.
In this case, the method of "Files: list" in Drive API is used. Ref
In order to retrieve Google Document files, the search query of mimeType='application/vnd.google-apps.document' and trashed=false
is used.
The sample curl command is as follows.
curl
'https://www.googleapis.com/drive/v3/files?pageSize=1000&q=mimeType%3D%27application%2Fvnd.google-apps.document%27%20and%20trashed%3Dfalse'
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]'
--header 'Accept: application/json'
--compressed
When you want to retrieve the Google Document files in the specific folder, please use mimeType='application/vnd.google-apps.document' and trashed=false and '###' in parents
as the search query.
When above curl command is run, the file list including the file IDs is returned.
In this sample, the page size is 1000. When you have more document files, please use pageToken
.
Retrieve the data from Google Document files.
- In this case, the method of "documents.get" in Google Docs API is used.
- Using the file IDs retrieved by above method, you can retrieve all Google Document files. In the current stage, I think that in this case, it is required to request to the endpoint for each Document ID in a loop.
- In this case, the endpoint in your question can be used.
References:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…