Method: files.generateIds
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Menghasilkan serangkaian ID file yang dapat diberikan dalam permintaan pembuatan atau penyalinan. Untuk mengetahui informasi selengkapnya, lihat Membuat dan mengelola file.
Permintaan HTTP
GET https://www.googleapis.com/drive/v3/files/generateIds
URL menggunakan sintaksis gRPC Transcoding.
Parameter kueri
Parameter |
count |
integer
Jumlah ID yang akan ditampilkan.
|
space |
string
Ruang tempat ID dapat digunakan untuk membuat file. Nilai yang didukung adalah drive dan appDataFolder . (Default: drive .) Untuk mengetahui informasi selengkapnya, lihat Organisasi file.
|
type |
string
Jenis item yang dapat menggunakan ID. Nilai yang didukung adalah files dan shortcuts . Perhatikan bahwa shortcuts hanya didukung di drive space . (Default: files .) Untuk mengetahui informasi selengkapnya, lihat Organisasi file.
|
Isi permintaan
Isi permintaan harus kosong.
Isi respons
Daftar ID file yang dihasilkan yang dapat diberikan dalam permintaan pembuatan.
Jika berhasil, isi respons memuat data dengan struktur berikut:
Representasi JSON |
{
"ids": [
string
],
"space": string,
"kind": string
} |
Kolom |
ids[] |
string
ID yang dibuat untuk pengguna yang meminta di ruang yang ditentukan.
|
space |
string
Jenis file yang dapat dibuat dengan ID ini.
|
kind |
string
Mengidentifikasi jenis resource ini. Nilai: string tetap "drive#generatedIds" .
|
Cakupan otorisasi
Memerlukan salah satu cakupan OAuth berikut:
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.appdata
https://www.googleapis.com/auth/drive.file
Beberapa cakupan dibatasi dan memerlukan penilaian keamanan agar aplikasi Anda dapat menggunakannya. Untuk mengetahui informasi selengkapnya, lihat Panduan otorisasi.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-08-27 UTC.
[null,null,["Terakhir diperbarui pada 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)."]]