Method: files.watch
برای تغییرات یک فایل مشترک می شود.
درخواست HTTP
POST https://www.googleapis.com/drive/v3/files/{fileId}/watch
URL از دستور GRPC Transcoding استفاده می کند.
پارامترهای مسیر
مولفه های |
---|
fileId | string شناسه فایل |
پارامترهای پرس و جو
مولفه های |
---|
supportsAllDrives | boolean اینکه آیا برنامه درخواست کننده هم از My Drives و هم درایوهای مشترک پشتیبانی می کند. |
supportsTeamDrives (deprecated) | boolean منسوخ شده: به جای آن از supportsAllDrives استفاده کنید. |
acknowledgeAbuse | boolean این که آیا کاربر خطر دانلود بدافزار شناخته شده یا سایر فایل های توهین آمیز را تأیید می کند. این تنها زمانی قابل اعمال است که پارامتر alt روی media تنظیم شده باشد و کاربر مالک فایل یا سازمان دهنده درایو مشترکی باشد که فایل در آن قرار دارد. |
includePermissionsForView | string مشخص می کند که کدام مجوزهای اضافی در پاسخ گنجانده شود. فقط "منتشر شده" پشتیبانی می شود. |
includeLabels | string فهرستی از شناسههای برچسبهایی که با کاما از هم جدا شدهاند تا در قسمت labelInfo پاسخ قرار داده شوند. |
درخواست بدن
بدنه درخواست حاوی نمونهای از Channel
است.
بدن پاسخگو
در صورت موفقیت آمیز بودن، بدنه پاسخ حاوی نمونه ای از Channel
است.
محدوده مجوز
به یکی از حوزه های OAuth زیر نیاز دارد:
-
https://www.googleapis.com/auth/drive
-
https://www.googleapis.com/auth/drive.appdata
-
https://www.googleapis.com/auth/drive.file
-
https://www.googleapis.com/auth/drive.meet.readonly
-
https://www.googleapis.com/auth/drive.metadata
-
https://www.googleapis.com/auth/drive.metadata.readonly
-
https://www.googleapis.com/auth/drive.photos.readonly
-
https://www.googleapis.com/auth/drive.readonly
برخی از دامنه ها محدود هستند و برای استفاده از برنامه شما به ارزیابی امنیتی نیاز دارند. برای اطلاعات بیشتر، به راهنمای مجوز مراجعه کنید.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2024-10-30 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2024-10-30 بهوقت ساعت هماهنگ جهانی."],[[["Subscribes to changes to a file using the `POST https://www.googleapis.com/drive/v3/files/{fileId}/watch` endpoint, where `{fileId}` represents the ID of the file."],["Request body and successful response body both contain an instance of [Channel](/drive/api/reference/rest/v3/channels#Channel), enabling subscription to file changes."],["Accepts various query parameters like `supportsAllDrives`, `acknowledgeAbuse`, `includePermissionsForView`, and `includeLabels` to customize the subscription request."],["Requires authorization with one of the listed OAuth scopes, such as `https://www.googleapis.com/auth/drive` or `https://www.googleapis.com/auth/drive.file`, to access and subscribe to file changes."]]],["This outlines how to subscribe to file changes using a `POST` request to `https://www.googleapis.com/drive/v3/files/{fileId}/watch`. Key actions include setting the `fileId` in the path and using query parameters like `supportsAllDrives`, `acknowledgeAbuse`, `includePermissionsForView`, and `includeLabels`. The request and response bodies both use a `Channel` instance. The request requires specific authorization scopes, such as `drive`, `drive.file`, or `drive.readonly`. Some scopes have restrictions.\n"]]