Créer une autorisation avec l'API Google Drive

Partage un fichier ou dossier et renvoie la nouvelle autorisation avec son id. Google envoie un e-mail aux utilisateurs et groupes, sauf si sendNotificationEmail vaut false.

Identifiant
google_drive_create_permission

L'appel

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"
  }
}

Votre système envoie l'id de la connexion de votre client et les arguments de la tool. Les headers sont les mêmes que pour toute l'API Connect : le token de votre produit et celui de votre client.

Paramètres

Les descriptions des paramètres suivent la documentation officielle de l'app, en anglais.

ParamètreTypeObligatoireDescription
fileIdstringOuiFile or folder id from List files.
rolestringOuiAccess to grant. fileOrganizer and organizer only exist in shared drives.Valeurs : reader, commenter, writer, fileOrganizer, organizer
typestringOuiWho receives it: a user or group by e-mail, everyone in a domain, or anyone with the link.Valeurs : user, group, domain, anyone
emailAddressstringNonE-mail of the user or group, for type user or group.
domainstringNonDomain, such as example.com, for type domain.
allowFileDiscoverybooleanNonFor type domain or anyone, whether the file shows up in search. Without it the file is reached only by its link.
expirationTimestringNonWhen the access ends, RFC 3339, in the future and at most a year away. Only for type user or group.
sendNotificationEmailbooleanNonEmails users and groups about the share. The default is true; false shares silently.
emailMessagestringNonPlain text message added to the notification e-mail.
supportsAllDrivesbooleanNonSet to true when the file can be in a shared drive.
viewstringNonSet 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.Valeurs : published

Connexions possibles

Votre client connecte son compte Google Drive une seule fois, avec l'un des modes ci-dessous. La même connexion sert à toutes les tools du toolkit.

OAuth avec l'app de votre produit

Vous enregistrez une fois l'app OAuth de votre produit, avec POST /api/merchants/credentials/google_drive, et votre client autorise le compte sur un écran de consentement. Connect renouvelle le token avant son expiration.

La réponse

En cas de succès, Connect conserve le statut et le corps de la réponse de l'app. Les erreurs HTTP renvoyées par l'app utilisent l'objet {error, api_error} ; l'authentification ou la validation peuvent échouer avant l'exécution. Le header X-Toolkit-Execution-Id identifie l'exécution enregistrée, consultable avec GET /api/tools/executions/{uuid}.

Prête pour les agents IA

L'input de cette tool est un JSON Schema, disponible via GET /api/tools/google_drive_create_permission. Il devient la définition de tool de votre agent sans conversion.

Autres tools Google Drive

Voir les 12 tools

Toolkits de la même catégorie

Voir les 100 toolkits

Voyez Connect appliqué à votre produit.

Essayez-le pendant 15 jours sans carte, ou présentez votre cas à notre équipe.