Method: users.watch
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
প্রদত্ত ব্যবহারকারীর মেলবক্সে একটি পুশ বিজ্ঞপ্তি ঘড়ি সেট আপ বা আপডেট করুন৷
HTTP অনুরোধ
POST https://gmail.googleapis.com/gmail/v1/users/{userId}/watch
URL gRPC ট্রান্সকোডিং সিনট্যাক্স ব্যবহার করে।
পাথ প্যারামিটার
পরামিতি |
---|
userId | string ব্যবহারকারীর ইমেইল ঠিকানা. বিশেষ মান me প্রমাণীকৃত ব্যবহারকারী নির্দেশ করতে ব্যবহার করা যেতে পারে। |
শরীরের অনুরোধ
অনুরোধের অংশে নিম্নলিখিত কাঠামো সহ ডেটা রয়েছে:
ক্ষেত্র |
---|
labelIds[] | string লেবেলআইডগুলির তালিকা সম্পর্কে বিজ্ঞপ্তিগুলি সীমাবদ্ধ করতে৷ ডিফল্টরূপে, অনির্দিষ্ট থাকলে, সমস্ত পরিবর্তন পুশ করা হয়। যদি নির্দিষ্ট করা থাকে তাহলে একটি পুশ বিজ্ঞপ্তি তৈরি করার জন্য কোন লেবেল প্রয়োজন তা নির্দেশ করে৷ |
labelFilterAction (deprecated) | enum ( LabelFilterAction ) labelIds list ফিল্টারিং আচরণ নির্দিষ্ট করা হয়েছে। এই ক্ষেত্রটি অবহেলিত কারণ এটি কিছু ক্ষেত্রে ভুল আচরণ করেছে; পরিবর্তে labelFilterBehavior ব্যবহার করুন। |
labelFilterBehavior | enum ( LabelFilterAction ) labelIds list ফিল্টারিং আচরণ নির্দিষ্ট করা হয়েছে। এই ক্ষেত্রটি labelFilterAction প্রতিস্থাপন করে; সেট করা হলে, labelFilterAction উপেক্ষা করা হয়। |
topicName | string ইভেন্টগুলি প্রকাশ করার জন্য একটি সম্পূর্ণরূপে যোগ্যতাসম্পন্ন Google Cloud Pub/Sub API বিষয়ের নাম৷ এই বিষয়ের নামটি অবশ্যই ক্লাউড পাব/সাব-এ ইতিমধ্যেই বিদ্যমান থাকতে হবে এবং আপনি ইতিমধ্যেই এটিতে gmail "প্রকাশ করুন" অনুমতি দিয়েছেন৷ উদাহরণস্বরূপ, "projects/my-project-identifier/topics/my-topic-name" (ক্লাউড পাব/সাব "v1" বিষয়ের নামকরণ ফর্ম্যাট ব্যবহার করে)। মনে রাখবেন যে "my-project-identifier" অংশটি অবশ্যই আপনার Google ডেভেলপার প্রজেক্ট আইডির সাথে হুবহু মিলে যাবে (যেটি এই ঘড়ির অনুরোধটি কার্যকর করছে)। |
প্রতিক্রিয়া শরীর
পুশ বিজ্ঞপ্তি ঘড়ি প্রতিক্রিয়া.
সফল হলে, প্রতিক্রিয়া বডিতে নিম্নলিখিত কাঠামোর সাথে ডেটা থাকে:
JSON প্রতিনিধিত্ব |
---|
{
"historyId": string,
"expiration": string
} |
ক্ষেত্র |
---|
historyId | string মেইলবক্সের বর্তমান ইতিহাস রেকর্ডের আইডি। |
expiration | string ( int64 format) যখন Gmail মেইলবক্স আপডেটের জন্য বিজ্ঞপ্তি পাঠানো বন্ধ করবে (epoch Millis)। ঘড়ি পুনর্নবীকরণ করার জন্য এই সময়ের আগে আবার watch কল করুন. |
অনুমোদনের সুযোগ
নিম্নলিখিত OAuth সুযোগগুলির মধ্যে একটি প্রয়োজন:
-
https://mail.google.com/
-
https://www.googleapis.com/auth/gmail.modify
-
https://www.googleapis.com/auth/gmail.readonly
-
https://www.googleapis.com/auth/gmail.metadata
আরও তথ্যের জন্য, অনুমোদন নির্দেশিকা দেখুন।
লেবেল ফিল্টার অ্যাকশন
লেবেলআইড তালিকার ফিল্টারিং আচরণ নির্দিষ্ট করা হয়েছে।
Enums |
---|
include | শুধুমাত্র নির্দিষ্ট লেবেলআইড সম্পর্কিত বার্তা পরিবর্তনের জন্য পুশ বিজ্ঞপ্তি পান। |
exclude | উল্লেখিত লেবেলআইডগুলি ব্যতীত সমস্ত বার্তা পরিবর্তনের জন্য পুশ বিজ্ঞপ্তি পান৷ |
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-07-25 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-07-25 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["# Method: users.watch\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n - [JSON representation](#body.WatchResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [LabelFilterAction](#LabelFilterAction)\n\nSet up or update a push notification watch on the given user mailbox.\n\n### HTTP request\n\n`POST https://gmail.googleapis.com/gmail/v1/users/{userId}/watch`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------------------------------------|\n| `userId` | `string` The user's email address. The special value `me` can be used to indicate the authenticated user. |\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"labelIds\": [ string ], \"labelFilterAction\": enum (/workspace/gmail/api/reference/rest/v1/users/watch#LabelFilterAction), \"labelFilterBehavior\": enum (/workspace/gmail/api/reference/rest/v1/users/watch#LabelFilterAction), \"topicName\": string } ``` |\n\n| Fields ||\n|--------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `labelIds[]` | `string` List of labelIds to restrict notifications about. By default, if unspecified, all changes are pushed out. If specified then dictates which labels are required for a push notification to be generated. |\n| `labelFilterAction` **(deprecated)** | `enum (`[LabelFilterAction](/workspace/gmail/api/reference/rest/v1/users/watch#LabelFilterAction)`)` Filtering behavior of `labelIds list` specified. This field is deprecated because it caused incorrect behavior in some cases; use `labelFilterBehavior` instead. |\n| `labelFilterBehavior` | `enum (`[LabelFilterAction](/workspace/gmail/api/reference/rest/v1/users/watch#LabelFilterAction)`)` Filtering behavior of `labelIds list` specified. This field replaces `labelFilterAction`; if set, `labelFilterAction` is ignored. |\n| `topicName` | `string` A fully qualified Google Cloud Pub/Sub API topic name to publish the events to. This topic name **must** already exist in Cloud Pub/Sub and you **must** have already granted gmail \"publish\" permission on it. For example, \"projects/my-project-identifier/topics/my-topic-name\" (using the Cloud Pub/Sub \"v1\" topic naming format). Note that the \"my-project-identifier\" portion must exactly match your Google developer project id (the one executing this watch request). |\n\n### Response body\n\nPush notification watch response.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|-------------------------------------------------------|\n| ``` { \"historyId\": string, \"expiration\": string } ``` |\n\n| Fields ||\n|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `historyId` | `string` The ID of the mailbox's current history record. |\n| `expiration` | `string (`[int64](https://developers.google.com/discovery/v1/type-format)` format)` When Gmail will stop sending notifications for mailbox updates (epoch millis). Call `watch` again before this time to renew the watch. |\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://mail.google.com/`\n- `\n https://www.googleapis.com/auth/gmail.modify`\n- `\n https://www.googleapis.com/auth/gmail.readonly`\n- `\n https://www.googleapis.com/auth/gmail.metadata`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent).\n\nLabelFilterAction\n-----------------\n\nFiltering behavior of labelIds list specified.\n\n| Enums ||\n|-----------|---------------------------------------------------------------------------------------------|\n| `include` | Only get push notifications for message changes relating to labelIds specified. |\n| `exclude` | Get push notifications for all message changes except those relating to labelIds specified. |"]]