Method: files.generateIds
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
مجموعه ای از شناسه های فایل را ایجاد می کند که می توانند در درخواست های درج یا کپی ارائه شوند.
درخواست HTTP
GET https://www.googleapis.com/drive/v2/files/generateIds
URL از دستور GRPC Transcoding استفاده می کند.
پارامترهای پرس و جو
پارامترها |
---|
maxResults | integer حداکثر تعداد شناسه برای بازگشت. |
space | string فضایی که در آن شناسه ها می توانند برای ایجاد فایل های جدید استفاده شوند. مقادیر پشتیبانی شده عبارتند از drive و appDataFolder . (پیشفرض: drive ) |
type | string نوع مواردی که شناسه ها می توانند برای آنها استفاده شوند. مقادیر پشتیبانی شده files و shortcuts هستند. توجه داشته باشید که shortcuts فقط در space drive پشتیبانی می شوند. (پیشفرض: files ) |
درخواست بدن
بدنه درخواست باید خالی باشد.
بدن پاسخگو
لیستی از شناسه های تولید شده که می توانند در درخواست های درج ارائه شوند
در صورت موفقیت آمیز بودن، بدنه پاسخ حاوی داده هایی با ساختار زیر است:
نمایندگی JSON |
---|
{
"ids": [
string
],
"space": string,
"kind": string
} |
فیلدها |
---|
ids[] | string شناسه های ایجاد شده برای کاربر درخواست کننده در فضای مشخص شده. |
space | string نوع فایلی که می توان با این شناسه ها ایجاد کرد. |
kind | string این همیشه drive#generatedIds است |
محدوده مجوز
به یکی از حوزه های OAuth زیر نیاز دارد:
-
https://www.googleapis.com/auth/docs
-
https://www.googleapis.com/auth/drive
-
https://www.googleapis.com/auth/drive.appdata
-
https://www.googleapis.com/auth/drive.file
برخی از دامنه ها محدود هستند و برای استفاده از برنامه شما به ارزیابی امنیتی نیاز دارند. برای اطلاعات بیشتر، به راهنمای مجوز مراجعه کنید.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی."],[],[],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 insert or copy requests.\n\n### HTTP request\n\n`GET https://www.googleapis.com/drive/v2/files/generateIds`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `maxResults` | `integer` Maximum 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 IDs which can be provided in insert 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` This is always `drive#generatedIds` |\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/docs`\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)."]]