Method: files.generateIds
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
สร้างชุดรหัสไฟล์ที่ระบุได้ในคำขอสร้างหรือคัดลอก ดูข้อมูลเพิ่มเติมได้ที่หัวข้อสร้างและจัดการไฟล์
คำขอ HTTP
GET https://www.googleapis.com/drive/v3/files/generateIds
URL ใช้ไวยากรณ์การแปลงรหัส gRPC
พารามิเตอร์การค้นหา
พารามิเตอร์ |
count |
integer
จำนวนรหัสที่จะแสดงผล
|
space |
string
พื้นที่ที่ใช้รหัสเพื่อสร้างไฟล์ได้ ค่าที่รองรับคือ drive และ appDataFolder (ค่าเริ่มต้น: drive ) ดูข้อมูลเพิ่มเติมได้ที่การจัดระเบียบไฟล์
|
type |
string
ประเภทของรายการที่ใช้รหัสได้ ค่าที่รองรับคือ files และ shortcuts โปรดทราบว่าระบบรองรับ shortcuts ใน drive space เท่านั้น (ค่าเริ่มต้น: files ) ดูข้อมูลเพิ่มเติมได้ที่การจัดระเบียบไฟล์
|
เนื้อความของคำขอ
เนื้อหาของคำขอต้องว่างเปล่า
เนื้อหาการตอบกลับ
รายการรหัสไฟล์ที่สร้างขึ้นซึ่งระบุได้ในคำขอสร้าง
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีข้อมูลซึ่งมีโครงสร้างดังต่อไปนี้
การแสดง JSON |
{
"ids": [
string
],
"space": string,
"kind": string
} |
ช่อง |
ids[] |
string
รหัสที่สร้างขึ้นสำหรับผู้ใช้ที่ส่งคำขอในพื้นที่ที่ระบุ
|
space |
string
ประเภทไฟล์ที่สร้างได้ด้วยรหัสเหล่านี้
|
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)."]]