Method: files.generateIds
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
產生一組檔案 ID,可在建立或複製要求中提供。詳情請參閱「建立及管理檔案」。
HTTP 要求
GET https://www.googleapis.com/drive/v3/files/generateIds
這個網址使用 gRPC 轉碼語法。
查詢參數
參數 |
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
部分範圍受到限制,應用程式必須通過安全性評估才能使用。詳情請參閱授權指南。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-27 (世界標準時間)。
[null,null,["上次更新時間:2025-08-27 (世界標準時間)。"],[],[],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)."]]