Method: spaces.search
根據管理員的搜尋內容,傳回 Google Workspace 機構中的聊天室清單。
需要具備管理員權限的使用者驗證。在要求中,將 useAdminAccess
設為 true
。
HTTP 要求
GET https://chat.googleapis.com/v1/spaces:search
這個網址使用 gRPC 轉碼語法。
查詢參數
參數 |
useAdminAccess |
boolean
當 true 時,方法會使用使用者的 Google Workspace 管理員權限執行。 撥打電話的使用者必須是具備「管理即時通訊和聊天室對話」權限的 Google Workspace 管理員。 需要 chat.admin.spaces.readonly 或 chat.admin.spaces OAuth 2.0 範圍。 這個方法目前僅支援管理員存取權,因此這個欄位只接受 true 。
|
pageSize |
integer
要傳回的聊天室數量上限。服務傳回的產品數量可能會少於這個值。 如未指定,最多會傳回 100 個空格。 值的上限為 1000。如果您使用的值超過 1000,系統會自動將其變更為 1000。
|
pageToken |
string
從先前搜尋空間呼叫傳回的符記。提供這個參數即可擷取後續網頁。 進行分頁時,提供的所有其他參數都應與提供網頁權杖的呼叫相符。將不同值傳遞至其他參數可能會導致意外結果。
|
query |
string
必要欄位。搜尋查詢。 您可以使用下列參數進行搜尋:
createTime
customer
displayName
externalUserAllowed
lastActiveTime
spaceHistoryState
spaceType
createTime 和 lastActiveTime 接受 RFC-3339 格式的時間戳記,支援的比較運算子為 = 、< 、> 、<= 、>= 。
customer 為必要參數,用於指出要從哪位客戶擷取聊天室。customers/my_customer 是唯一支援的值。
displayName 只接受 HAS (: ) 運算子。要比對的文字會先以代碼化為符記,每個符記均區分大小寫,且獨立為字串 displayName 中任何位置的子字串。舉例來說,Fun Eve 與 Fun event 或 The
evening was fun 相符,但與 notFun event 或 even 不相符。
externalUserAllowed 接受 true 或 false 。
spaceHistoryState 只接受 space 資源 historyState 欄位的值。
spaceType 為必填欄位,唯一有效的值為 SPACE 。
在不同欄位中,系統僅支援 AND 運算子。有效的例子為 spaceType = "SPACE" AND displayName:"Hello" ,無效的例子為 spaceType = "SPACE" OR displayName:"Hello" 。 在相同欄位中,spaceType 不支援 AND 或 OR 運算子。displayName 、"spaceHistoryState" 和 "externalUserAllowed" 僅支援 OR 運算子。lastActiveTime 和 createTime 都支援 AND 和 OR 運算子。AND 只能用來表示間隔,例如 lastActiveTime
< "2022-01-01T00:00:00+00:00" AND lastActiveTime >
"2023-01-01T00:00:00+00:00" 。 以下查詢範例有效:
customer = "customers/my_customer" AND spaceType = "SPACE"
customer = "customers/my_customer" AND spaceType = "SPACE" AND
displayName:"Hello World"
customer = "customers/my_customer" AND spaceType = "SPACE" AND
(lastActiveTime < "2020-01-01T00:00:00+00:00" OR lastActiveTime >
"2022-01-01T00:00:00+00:00")
customer = "customers/my_customer" AND spaceType = "SPACE" AND
(displayName:"Hello World" OR displayName:"Fun event") AND
(lastActiveTime > "2020-01-01T00:00:00+00:00" AND lastActiveTime <
"2022-01-01T00:00:00+00:00")
customer = "customers/my_customer" AND spaceType = "SPACE" AND
(createTime > "2019-01-01T00:00:00+00:00" AND createTime <
"2020-01-01T00:00:00+00:00") AND (externalUserAllowed = "true") AND
(spaceHistoryState = "HISTORY_ON" OR spaceHistoryState = "HISTORY_OFF")
|
orderBy |
string
選用設定。聊天室清單的排序方式。 可用來排序的支援屬性如下:
membershipCount.joined_direct_human_user_count :表示直接加入聊天室的真人使用者人數。
lastActiveTime :表示上次將符合資格的項目新增至這個聊天室的任何主題的時間。
createTime :表示聊天室建立時間,
有效的排序作業值如下:
支援的語法如下:
membershipCount.joined_direct_human_user_count DESC
membershipCount.joined_direct_human_user_count ASC
lastActiveTime DESC
lastActiveTime ASC
createTime DESC
createTime ASC
|
回應主體
回應,其中包含與搜尋聊天室要求相對應的聊天室清單。
如果成功,回應主體會含有以下結構的資料:
JSON 表示法 |
{
"spaces": [
{
object (Space )
}
],
"nextPageToken": string,
"totalSize": integer
} |
欄位 |
spaces[] |
object (Space )
要求的聊天室頁面。
|
nextPageToken |
string
可用於擷取後續網頁的符記。如果這個欄位留空,表示沒有後續網頁。
|
totalSize |
integer
在所有網頁中,符合查詢的空間總數。如果結果超過 10,000 個空格,此值即為估計值。
|
授權範圍
需要下列其中一種 OAuth 範圍:
https://www.googleapis.com/auth/chat.admin.spaces
https://www.googleapis.com/auth/chat.admin.spaces.readonly
詳情請參閱授權指南。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-11-08 (世界標準時間)。
[null,null,["上次更新時間:2024-11-08 (世界標準時間)。"],[[["Returns a paginated list of Google Workspace spaces based on an administrator's search criteria, including parameters like displayName, createTime, and spaceType."],["Requires administrator privileges and the `useAdminAccess` parameter set to `true` in the request."],["Utilizes the `GET https://chat.googleapis.com/v1/spaces:search` HTTP request with query parameters for customization."],["Needs authorization with either the `chat.admin.spaces` or `chat.admin.spaces.readonly` OAuth scope."],["Response body includes an array of spaces, a token for pagination, and an estimate of the total number of matching spaces."]]],[]]