Method: files.generateIds
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Genera un insieme di ID file che possono essere forniti nelle richieste di creazione o copia. Per saperne di più, consulta Creare e gestire file.
Richiesta HTTP
GET https://www.googleapis.com/drive/v3/files/generateIds
L'URL utilizza la sintassi di transcodifica gRPC.
Parametri di query
Parametri |
count |
integer
Il numero di ID da restituire.
|
space |
string
Lo spazio in cui gli ID possono essere utilizzati per creare file. I valori supportati sono drive e appDataFolder . (Valore predefinito: drive ). Per ulteriori informazioni, consulta la sezione Organizzazione dei file.
|
type |
string
Il tipo di elementi per cui possono essere utilizzati gli ID. I valori supportati sono files e shortcuts . Tieni presente che shortcuts sono supportati solo in drive space . (Valore predefinito: files ). Per ulteriori informazioni, consulta la sezione Organizzazione dei file.
|
Corpo della richiesta
Il corpo della richiesta deve essere vuoto.
Corpo della risposta
Un elenco di ID file generati che possono essere forniti nelle richieste di creazione.
In caso di esito positivo, il corpo della risposta contiene dati con la seguente struttura:
Rappresentazione JSON |
{
"ids": [
string
],
"space": string,
"kind": string
} |
Campi |
ids[] |
string
Gli ID generati per l'utente richiedente nello spazio specificato.
|
space |
string
Il tipo di file che può essere creato con questi ID.
|
kind |
string
Identifica il tipo di risorsa. Valore: la stringa fissa "drive#generatedIds" .
|
Ambiti di autorizzazione
Richiede uno dei seguenti ambiti OAuth:
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.appdata
https://www.googleapis.com/auth/drive.file
Alcuni ambiti sono soggetti a restrizioni e richiedono una valutazione della sicurezza per poter essere utilizzati dalla tua app. Per ulteriori informazioni, consulta la Guida all'autorizzazione.
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-08-27 UTC.
[null,null,["Ultimo aggiornamento 2025-08-27 UTC."],[],[],null,["# Method: files.generateIds\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.GeneratedIds.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nGenerates a set of file IDs which can be provided in create or copy requests.\n\n### HTTP request\n\n`GET https://www.googleapis.com/drive/v3/files/generateIds`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `count` | `integer` The number of IDs to return. |\n| `space` | `string` The space in which the IDs can be used to create new files. Supported values are 'drive' and 'appDataFolder'. (Default: 'drive') |\n| `type` | `string` The type of items which the IDs can be used for. Supported values are 'files' and 'shortcuts'. Note that 'shortcuts' are only supported in the `drive` 'space'. (Default: 'files') |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nA list of generated file IDs which can be provided in create requests.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|----------------------------------------------------------------|\n| ``` { \"ids\": [ string ], \"space\": string, \"kind\": string } ``` |\n\n| Fields ||\n|---------|----------------------------------------------------------------------------------------------------|\n| `ids[]` | `string` The IDs generated for the requesting user in the specified space. |\n| `space` | `string` The type of file that can be created with these IDs. |\n| `kind` | `string` Identifies what kind of resource this is. Value: the fixed string `\"drive#generatedIds\"`. |\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/drive`\n- `\n https://www.googleapis.com/auth/drive.appdata`\n- `\n https://www.googleapis.com/auth/drive.file`\n\nSome scopes are restricted and require a security assessment for your app to use them. For more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]