Method: files.generateIds
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
作成リクエストまたはコピー リクエストで指定できるファイル ID のセットを生成します。詳細については、ファイルを作成、管理するをご覧ください。
HTTP リクエスト
GET https://www.googleapis.com/drive/v3/files/generateIds
この URL は gRPC Transcoding 構文を使用します。
クエリ パラメータ
パラメータ |
count |
integer
返す ID の数。
|
space |
string
ID を使用してファイルを作成できるスペース。サポートされる値は、drive と appDataFolder です。(デフォルト: drive )。詳細については、ファイルの構成をご覧ください。
|
type |
string
ID を使用できるアイテムのタイプ。サポートされる値は、files と shortcuts です。shortcuts は drive space でのみサポートされます。(デフォルト: files )。詳細については、ファイルの構成をご覧ください。
|
リクエストの本文
リクエストの本文は空にする必要があります。
レスポンスの本文
作成リクエストで指定できる生成済みファイル ID のリスト。
成功した場合、レスポンスの本文には次の構造のデータが含まれます。
JSON 表現 |
{
"ids": [
string
],
"space": string,
"kind": string
} |
フィールド |
ids[] |
string
指定されたスペースでリクエスト ユーザー用に生成された ID。
|
space |
string
これらの ID で作成できるファイルの種類。
|
kind |
string
リソースの種類を示します。値は固定文字列 "drive#generatedIds" です。
|
認可スコープ
次の OAuth スコープのいずれかが必要です。
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.appdata
https://www.googleapis.com/auth/drive.file
一部のスコープは制限されており、アプリでそれらを使用するにはセキュリティ評価が必要です。詳しくは、承認ガイドをご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-27 UTC。
[null,null,["最終更新日 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)."]]