Google DRIVE API - Get list of all files

Andrew_239256
Andrew_239256 Posts: 16 admin
edited January 12 in API Actions

The following guide utilizes the Google DRIVE API to get a list of all files in a Google DRIVE folder

While native actions in Catalytic allow builders to interact with Google DRIVE in several ways, builders can further leverage the standard Google DRIVE integration using the existing GET, POST, PUT, PATCH, and DELETE API actions to access a broader set of endpoints within the Google DRIVE API library.

With Catalytic managing API authentication, this functionality allows builders to quickly and simply extend Catalytic’s Google DRIVE integration to accomplish custom Google DRIVE actions within a workflow.

To obtain a JSON list of files contained within a Google DRIVE folder using a custom API endpoint, please follow the instructions below:

Step 1: Set up Google DRIVE integration

Note: If a Google DRIVE integration has already been set up, move to step 2.

For detailed instructions on how to set up a Google DRIVE integration, reference the following help article within the Catalytic knowledgebase:
https://help.catalytic.com/docs/google-drive-integration-setup-guide/

Step 2: Configure Catalytic action to get list of all files

In a new or existing workflow, add a new action of type ‘Web API: Send GET Request’. Configure as follows:

Integration:
API endpoint:
https://www.googleapis.com/drive/v3/files

Headers: Leave blank
Request body: Leave blank

Additional Examples:

Example 1: Get all files in a Google DRIVE folder (parent)

API endpoint syntax:
https://www.googleapis.com/drive/v3/files?q='{{folderid}}' in parents

To form, replace {{folderid}} with folder ID: 1tA7X3WOBZCi5baQmdbyaFlftfHq6vVtz
https://www.googleapis.com/drive/v3/files?q='1tA7X3WOBZCi5baQmdbyaFlftfHq6vVtz' in parents

Example 2: Get all files with the file name 'Sample'

API endpoint syntax:
https://www.googleapis.com/drive/v3/files?q=name='Sample'

Example 3: Files with a name containing the words "hello" and "goodbye

API endpoint syntax:
https://www.googleapis.com/drive/v3/files?q=name contains 'hello' and name contains 'goodbye'

Full customization of the endpoint is beyond the scope of this guide. For additional query string examples, please reference the Google DRIVE API documentation (section Query String examples).
https://developers.google.com/drive/api/v3/search-files

Step 3: Test your workflow

Click the test button to get list of all files stored in the target Google DRIVE folder.

Please reference the sample workflow attached for testing purposes.