LiveChatMessages: transition
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
העברת הסטטוס של הודעת צ'אט בשידור חי ב-YouTube והתחלת תהליכים שמשויכים לסטטוס החדש. לדוגמה, כשמעבירים את הסטטוס של סקר בשידור חי לclosed
, המערכת של YouTube מסיימת את הסקר של ההודעה הזו. לפני שמפעילים את השיטה הזו, צריך לוודא שהערך של הנכס status
עבור הודעת הסקר בשידור חי הוא active
.
בקשה
בקשת HTTP
POST https://www.googleapis.com/youtube/v3/liveChatMessages/transition
אישור
הבקשה הזו מחייבת הרשאה עם לפחות אחד מההיקפים הבאים (מידע נוסף על אימות והרשאה).
היקף |
https://www.googleapis.com/auth/youtube |
https://www.googleapis.com/auth/youtube.force-ssl |
פרמטרים
בטבלה הבאה מפורטים הפרמטרים שנתמכים בשאילתה הזו. כל הפרמטרים הרשומים הם פרמטרים של שאילתות.
פרמטרים |
פרמטרים נדרשים |
id |
string
הפרמטר id מציין את המזהה הייחודי של ההודעה שעוברת לסטטוס אחר. |
status |
enum
הפרמטר status מזהה את המצב שבו ההודעה משתנה. כדי להעביר הודעה למצב closed , status צריך להיות active בסקר שאליו ההודעה קשורה.
אפשר לעבור רק אל closed , כלומר הסקר סגור.
|
פרמטרים אופציונליים |
part |
string
הפרמטר part מציין את חלקי המשאב liveChatMessage שתגובת ה-API תכלול. הערכים הנתמכים הם id , snippet ו-authorDetails .
צריך להגדיר את ערך הפרמטר כ-snippet כדי לקבל את התוצאה הסופית של הסקר בגוף התשובה.
|
גוף הבקשה
אין לספק גוף בקשה כשמבצעים קריאה ל-method הזה.
שגיאות
הטבלה הבאה מזהה את הודעות השגיאה שה-API יכול להחזיר בתגובה לקריאה ל-method הזה. אפשר לקרוא פרטים נוספים בתיעוד של הודעות שגיאה.
סוג השגיאה |
פרטי השגיאה |
תיאור |
forbidden (403) |
forbidden |
אין לך את ההרשאות שנדרשות להעברת הסטטוס של ההודעה שצוינה. |
required (400) |
idRequired |
פרמטר החובה id חייב לזהות את ההודעה שאת הסטטוס שלה רוצים להעביר. |
required (400) |
statusRequired |
בבקשת ה-API צריך לציין ערך לפרמטר status . |
notFound (404) |
liveChatMessagesNotFound |
ההודעה שצוינה על ידי הפרמטר id לא קיימת. |
forbidden (403) |
modificationNotAllowed |
אי אפשר להעביר את הסטטוס של המשאב liveChatMessage שצוין. הפרמטר id עשוי לזהות הודעה שאי אפשר להעביר את הסטטוס שלה. |
נסה בעצמך!
אפשר להשתמש ב-APIs Explorer כדי לשלוח קריאה ל-API הזה ולראות את בקשת ה-API והתגובה.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2024-08-08 (שעון UTC).
[null,null,["עדכון אחרון: 2024-08-08 (שעון UTC)."],[[["\u003cp\u003eThis API endpoint transitions the status of a YouTube live chat message, such as closing an active poll.\u003c/p\u003e\n"],["\u003cp\u003eThe request requires authorization and must include the message's unique \u003ccode\u003eid\u003c/code\u003e and the new \u003ccode\u003estatus\u003c/code\u003e (\u003ccode\u003eclosed\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003epart\u003c/code\u003e parameter, which is optional, specifies which parts of the \u003ccode\u003eliveChatMessage\u003c/code\u003e resource to include in the API response (e.g. \u003ccode\u003esnippet\u003c/code\u003e, \u003ccode\u003eid\u003c/code\u003e, \u003ccode\u003eauthorDetails\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eSuccessful calls to this API will return a \u003ccode\u003eliveChatMessages\u003c/code\u003e resource in the response body, detailing the message's new status.\u003c/p\u003e\n"],["\u003cp\u003eCommon errors include \u003ccode\u003eforbidden\u003c/code\u003e for permission issues, \u003ccode\u003erequired\u003c/code\u003e for missing parameters, \u003ccode\u003enotFound\u003c/code\u003e if the message ID doesn't exist, and \u003ccode\u003emodificationNotAllowed\u003c/code\u003e if the specified message's status can't be changed.\u003c/p\u003e\n"]]],["This API endpoint, `liveChatMessages/transition`, changes a YouTube live chat message's status and triggers related actions. It requires the message's `id` and the target `status`, which can only be `closed`. The `status` of the poll must be `active` to proceed with the transition. The request is a `POST` method without a request body. Authorization scopes `youtube` or `youtube.force-ssl` are needed. Upon success, a `liveChatMessages` resource is returned, and errors include `forbidden`, `required`, and `notFound`.\n"],null,["# LiveChatMessages: transition\n\nTransitions the status of a YouTube live chat message and initiates any processes associated with the new status. For example, when you transition a live poll's status to `closed`, YouTube ends that message's poll. Before calling this method, you should confirm that the value of the [status](/youtube/v3/live/docs/liveChatMessages#snippet.pollDetails.metadata.status) property for the live poll message is `active`.\n\nRequest\n-------\n\n### HTTP request\n\n```\nPOST https://www.googleapis.com/youtube/v3/liveChat/messages/transition\n```\n\n### Authorization\n\nThis request requires authorization with at least one of the following scopes ([read more about authentication and authorization](/youtube/v3/live/authentication)).\n\n| Scope |\n|-----------------------------------------------------|\n| `https://www.googleapis.com/auth/youtube` |\n| `https://www.googleapis.com/auth/youtube.force-ssl` |\n\n### Parameters\n\nThe following table lists the parameters that this query supports. All of the parameters listed are query parameters.\n\n| Parameters ||\n|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| **Required parameters** |||\n| `id` | `string` The **id** parameter specifies the unique ID of the message that is transitioning to another status. |\n| `status` | `enum` The **status** parameter identifies the state to which the message is changing. To transition a message to the `closed` state, the [status](/youtube/v3/live/docs/liveChatMessages#snippet.pollDetails.metadata.status) must be `active` for the poll that the message is bound to. \u003cbr /\u003e You can only transition to **closed**, meaning that the poll is closed. |\n| **Optional parameters** |||\n| `part` | `string` The **part** parameter specifies the `liveChatMessage` resource parts that the API response will include. Supported values are `id`, `snippet`, and `authorDetails`. \u003cbr /\u003e Set the parameter value to `snippet` to get the final poll result in the response body. |\n\n### Request body\n\nDo not provide a request body when calling this method.\n\nResponse\n--------\n\nIf successful, this method returns a [liveChatMessages resource](/youtube/v3/live/docs/liveChatMessages#resource) in the response body.\n\nErrors\n------\n\nThe following table identifies error messages that the API could return in response to a call to this method. Please see the [error message](/youtube/v3/live/docs/errors) documentation for more detail.\n\n| Error type | Error detail | Description |\n|-------------------|----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `forbidden (403)` | `forbidden` | You don't have the permissions required to transition the status of the specified message. |\n| `required (400)` | `idRequired` | The required `id` parameter must identify the message whose status you want to transition. |\n| `required (400)` | `statusRequired` | The API request must specify a value for the `status` parameter. |\n| `notFound (404)` | `liveChatMessagesNotFound` | The message specified by the `id` parameter does not exist. |\n| `forbidden (403)` | `modificationNotAllowed` | The status of the specified `liveChatMessage` resource cannot be transitioned. The `id` parameter might identify a message whose status cannot be transitioned. |\n\nTry it!\n-------\n\nUse the APIs Explorer to call this API and see the API request and response."]]