# GoogleDrive

Google Drive is Google's online file storage and synchronization service, which can be used for file storage and backup, as well as for project collaboration.

The **Google Drive** plugin contains functions and types that allow you to programmatically access your files on Google Drive.

***

## Get Started with Google APIs

Google APIs is a set of application programming interfaces (APIs) developed by Google, which allow for communication with Google Services.

Two Linx plugins support integration with Google APIs:

* Google Drive
* Google Sheets

*Google Drive* is Google's online file storage and synchronization service, which can be used for file storage and backup, as well as for project collaboration.

*Google Sheets* is a web-based application for creating and editing spreadsheets.

***

**To integrate Linx with a specific Google API, you need the following:**

* A Google account
* A Google API project (set up on Google Console)
* An enabled API (e.g., Google Drive) added to your Google API project
* Connection credentials (e.g., a Service account key) created on Google Console
* A Linx solution containing:
  * the Google Drive or Google Sheets plugin
  * relevant Functions or Types from the plugin
  * the Google API connection credentials

***

**To integrate Linx with a Google API, do the following:**

1. **Enable a specific&#x20;*****Google API*****&#x20;for your Google account**\
   **Steps:**
   1. Go to the [Google API Console](https://console.developers.google.com).
   2. Create a *project* for your Google account.
   3. Add and enable the *Google Drive API* for your project.\
      \&#xNAN;*Do this*:
      * Click **Enable APIs and services**, or go to the API library (available in the menu on the left) to select an API.
      * Click on the **Google Drive API**.
      * Click **Enable**. *Also see the* [*Google Developer*](https://developers.google.com/drive/api/v3/enable-drive-api)*.*
   4. Create *Credentials* for access to your Google Drive.\
      \&#xNAN;*Do this*:
      * Click **Credentials** (available in the menu on the left).
      * Click **+ Create Credentials** (top menu), and select 'Service account Key'.
      * Provide the requested details specific to your application.
      * Create a *Service account name* and *Service account ID*.
      * Click **Continue** to skip setting up an optional *role* for the service account.
      * Click **Done**.
      * Click **Manage service accounts**.
      * Click on the **Actions icon**, then click **Create key**.
      * Select JSON and click **Create** to download a *credentials file* for use in your Linx solutions. *Also see* [*Google Developer*](https://cloud.google.com/iam/docs/service-accounts)*.*

{% hint style="info" %}
**Note:**

* In this guide, the Google Drive API is used as an example, but the process is similar for Google Sheets.
* The steps are intended as guidelines and not as definitive documentation of Google APIs. Our guidelines are correct at the time of publishing. References to Google developer documentation are included for your benefit.
* The exact display and flow of the steps above may depend on your Google account type, as well as the number of existing projects, enabled APIs, and credentials you already have.
  {% endhint %}

3. **Create your Linx solution**\
   **Steps:**
   1. Add the *Google Drive* plugin to your Solution.
   2. Select a relevant *Function* or *Type* and drag it onto the design canvas.
   3. Provide your *Google API connection* details.\
      The content of the JSON file that you downloaded in Step 1.4(i) above can be copied and pasted into the Expression Editor for this property.\
      When using the Expression Editor, make sure that the property names are in friendly property name format instead of the Google API names, i.e., "Type" instead of "type"or "ProjectId" instead of "project\_id".\
      You can also use the Values Editor to enter the values for each connection property:

      <figure><img src="/files/Ss9xog1nwIlI6FgQNHLM" alt="Values Editor"><figcaption></figcaption></figure>
   4. Set the other *properties* for the selected Function/Type.

***

## Functions

### About

* **GetAbout**: Gets information about the user, the user's Drive, and system capabilities.

### Changes

* **GetStartPageToken**: Gets the starting pageToken for listing future changes.
* **ListChanges**: Lists the changes for a user or shared drive.

### Comments

* **CreateComment**: Creates a new comment on a file.
* **DeleteComment**: Deletes a comment.
* **GetComment**: Gets a comment by ID.
* **ListComments**: Lists a file's comments.
* **UpdateComment**: Updates a comment with patch semantics.

### Files

* **CopyFile**: Creates a copy of a file.
* **CreateFile**: Creates a new file.
* **DeleteFile**: Permanently deletes a file owned by the user without moving it to the trash.
* **EmptyTrash**: Permanently deletes all of the user's trashed files.
* **ExportFile**: Exports a Google Doc to the requested MIME type and returns the exported content.
* **GenerateFieldIds**: Generates a set of file IDs which can be provided in create or copy requests.
* **GetFile**: Gets a file's metadata or content by ID.
* **ListFiles**: Lists or searches files.
* **UpdateFile**: Updates a file's metadata and/or content with patch semantics.

### Permissions

* **CreatePermission**: Creates a permission for a file or shared drive.
* **DeletePermission**: Deletes a permission.
* **GetPermission**: Gets a permission by ID.
* **ListPermissions**: Lists a file's or shared drive's permissions.
* **UpdatePermission**: Updates a permission with patch semantics.

### Replies

* **CreateReply**: Creates a new reply to a comment.
* **DeleteReply**: Deletes a reply.
* **GetReply**: Gets a reply by ID.
* **ListReplies**: Lists a comment's replies.
* **UpdateReply**: Updates a reply with patch semantics.

### Revisions

* **DeleteRevision**: Permanently deletes a file version for files with binary content in Google Drive, like images or videos.
* **GetRevision**: Gets a revision's metadata or content by ID.
* **ListRevisions**: Lists a file's revisions.
* **UpdateRevision**: Updates a revision with patch semantics.

## Types

* **ContentHintsData**: Creates a reusable type for additional information about the content of a file.
* **ThumbnailData**: Creates a reusable type for thumbnail data of a file.

***

## Links

[Google Developer documentation](https://developers.google.com/drive/api/v3/about-sdk)

[Google Drive License](/reference/plugins/googledrive/license.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.linx.software/reference/plugins/googledrive.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
