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 參數會指定轉換至其他狀態的訊息專屬 ID。 |
status |
enum
status 參數可識別訊息的變化狀態。如要將訊息轉換為 closed 狀態,針對訊息繫結的輪詢,status 必須是 active 。
您只能將其轉換為 closed ,表示意見調查已關閉。
|
選用參數 |
part |
string
part 參數會指定 API 回應將包含的 liveChatMessage 資源部分。支援的值為 id 、snippet 和 authorDetails 。
將參數值設為 snippet ,即可在回應主體中取得最終意見調查結果。
|
錯誤
下表顯示 API 為回應這個方法時,可能會傳回的錯誤訊息。詳情請參閱錯誤訊息說明文件。
錯誤類型 |
錯誤詳情 |
說明 |
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 要求和回應。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-08-08 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2024-08-08 (世界標準時間)。"],[[["This API endpoint transitions the status of a YouTube live chat message, such as closing an active poll."],["The request requires authorization and must include the message's unique `id` and the new `status` (`closed`)."],["The `part` parameter, which is optional, specifies which parts of the `liveChatMessage` resource to include in the API response (e.g. `snippet`, `id`, `authorDetails`)."],["Successful calls to this API will return a `liveChatMessages` resource in the response body, detailing the message's new status."],["Common errors include `forbidden` for permission issues, `required` for missing parameters, `notFound` if the message ID doesn't exist, and `modificationNotAllowed` if the specified message's status can't be changed."]]],["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"]]