Gera um conjunto de IDs de arquivo que podem ser fornecidos em solicitações de criação ou cópia. Para mais informações, consulte Criar e gerenciar arquivos.
Solicitação HTTP
GET https://www.googleapis.com/drive/v3/files/generateIds
O espaço em que os IDs podem ser usados para criar arquivos. Os valores aceitos são drive e appDataFolder. O padrão é drive. Para mais informações, consulte Organização de arquivos.
type
string
O tipo de itens para os quais os IDs podem ser usados. Os valores aceitos são files e shortcuts. Os shortcuts só são compatíveis com o drivespace. O padrão é files. Para mais informações, consulte Organização de arquivos.
Corpo da solicitação
O corpo da solicitação precisa estar vazio.
Corpo da resposta
Uma lista de IDs de arquivos gerados que podem ser fornecidos em solicitações de criação.
Se bem-sucedido, o corpo da resposta incluirá dados com a estrutura a seguir:
Representação JSON
{"ids": [string],"space": string,"kind": string}
Campos
ids[]
string
Os IDs gerados para o usuário solicitante no espaço especificado.
space
string
O tipo de arquivo que pode ser criado com esses IDs.
kind
string
Identifica o tipo de recurso. Valor: a string fixa "drive#generatedIds".
Escopos de autorização
Requer um dos seguintes escopos do OAuth:
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.appdata
https://www.googleapis.com/auth/drive.file
Alguns escopos são restritos e exigem uma avaliação de segurança para que o app possa usá-los. Para mais informações, consulte o guia de autorização.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Não contém as informações de que eu preciso","missingTheInformationINeed","thumb-down"],["Muito complicado / etapas demais","tooComplicatedTooManySteps","thumb-down"],["Desatualizado","outOfDate","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Problema com as amostras / o código","samplesCodeIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 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)."]]