Is it possible to get all the documents from google docs using google-docs API?
On the API reference page, I am not able to find API for get all the list of documents
the below api used for get single document using documentId.
GET https://docs.googleapis.com/v1/documents/{documentId}
Reference: https://developers.google.com/docs/api/reference/rest/v1/documents/get
If I forget the document Id, how can get the document? this information not available on the reference api page.
I believe your goal as follows.
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.