Crear permiso en Google Drive, con una API

Comparte un archivo o carpeta y devuelve el nuevo permiso con su id. Google envía un correo a los usuarios y grupos, salvo que sendNotificationEmail sea false.

Identificador
google_drive_create_permission

La llamada

POST https://connect.reportei.com/api/tools/google_drive_create_permission/execute
Authorization: Bearer <merchant token>
x-customer-token: <customer token>
Content-Type: application/json
Accept: application/json

{
  "customer_toolkit": "<connection UUID>",
  "arguments": {
    "fileId": "<fileId>",
    "role": "reader",
    "type": "user"
  }
}

Tu sistema envía el id de la conexión de tu cliente y los argumentos de la tool. Los headers son los mismos de toda la API de Connect: el token de tu producto y el token de tu cliente.

Parámetros

Las descripciones de los parámetros siguen la documentación oficial de la app, en inglés.

ParámetroTipoObligatorioDescripción
fileIdstringSíFile or folder id from List files.
rolestringSíAccess to grant. fileOrganizer and organizer only exist in shared drives.Valores: reader, commenter, writer, fileOrganizer, organizer
typestringSíWho receives it: a user or group by e-mail, everyone in a domain, or anyone with the link.Valores: user, group, domain, anyone
emailAddressstringNoE-mail of the user or group, for type user or group.
domainstringNoDomain, such as example.com, for type domain.
allowFileDiscoverybooleanNoFor type domain or anyone, whether the file shows up in search. Without it the file is reached only by its link.
expirationTimestringNoWhen the access ends, RFC 3339, in the future and at most a year away. Only for type user or group.
sendNotificationEmailbooleanNoEmails users and groups about the share. The default is true; false shares silently.
emailMessagestringNoPlain text message added to the notification e-mail.
supportsAllDrivesbooleanNoSet to true when the file can be in a shared drive.
viewstringNoSet it to published to grant access to the published view of a Google Form, which decides who can answer it: with type anyone, anyone with the link; with type user, the given email. Omit it for a normal permission on the file.Valores: published

Conexiones posibles

Tu cliente conecta su cuenta de Google Drive una sola vez, con uno de los modos de abajo. La misma conexión sirve para todas las tools del toolkit.

OAuth con la app de tu producto

Registras la app OAuth de tu producto una sola vez, con POST /api/merchants/credentials/google_drive, y tu cliente autoriza la cuenta en una pantalla de consentimiento. Connect renueva el token cuando está por vencer.

La respuesta

Si la llamada tiene éxito, Connect conserva el status y el cuerpo de la respuesta de la app. Los errores HTTP devueltos por la app usan el objeto {error, api_error}; la autenticación o validación pueden fallar antes de la ejecución. El header X-Toolkit-Execution-Id identifica la ejecución registrada, disponible en GET /api/tools/executions/{uuid}.

Lista para agentes de IA

El input de esta tool es un JSON Schema, disponible en GET /api/tools/google_drive_create_permission. Se convierte en la definición de tool de tu agente sin conversión.

Otras tools de Google Drive

Ver las 12 tools

Toolkits de la misma categoría

Ver los 100 toolkits

Mira Connect aplicado a tu producto.

Pruébalo durante 15 días sin tarjeta, o cuéntale tu caso a nuestro equipo.