Method: spaces.list
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
רשימה של המרחבים המשותפים שבהם המשתמש שמתקשר הוא חבר. שיחות צ'אט קבוצתיות וצ'אטים אישיים לא מופיעים ברשימה עד ששולחים את ההודעה הראשונה. דוגמה לכך מופיעה בקטע רשימת המרחבים המשותפים.
יש תמיכה בסוגי אימות הבאים:
כדי לקבל רשימה של כל המרחבים המשותפים שנקראו לפי ארגון ב-Google Workspace, צריך להשתמש במקום זאת בשיטה spaces.search()
באמצעות הרשאות אדמין ב-Workspace.
בקשת HTTP
GET https://chat.googleapis.com/v1/spaces
כתובת ה-URL משתמשת בתחביר של Transcoding של gRPC.
פרמטרים של שאילתה
פרמטרים |
pageSize |
integer
אופציונלי. המספר המקסימלי של מרחבים משותפים להחזרה. יכול להיות שהשירות יחזיר פחות מהערך הזה. אם לא צוין, המערכת תחזיר עד 100 מקומות פנויים. הערך המקסימלי הוא 1,000. אם משתמשים בערך גבוה מ-1,000, הוא ישתנה באופן אוטומטי ל-1,000. ערכים שליליים מחזירים שגיאה מסוג INVALID_ARGUMENT .
|
pageToken |
string
אופציונלי. אסימון דף, שהתקבל משיחה קודמת של list spaces. צריך לציין את הפרמטר הזה כדי לאחזר את הדף הבא. כשמחלקים לדפים, ערך המסנן צריך להתאים לקריאה שסיפקה את אסימון הדף. העברת ערך שונה עלולה להוביל לתוצאות בלתי צפויות.
|
filter |
string
אופציונלי. מסנן שאילתות. אפשר לסנן את המרחבים המשותפים לפי סוג המרחב (spaceType ). כדי לסנן לפי סוג המרחב המשותף, צריך לציין ערך enum תקין, כמו SPACE או GROUP_CHAT (הערך של spaceType לא יכול להיות SPACE_TYPE_UNSPECIFIED ). כדי לשלוח שאילתה לגבי כמה סוגי מרחבים משותפים, משתמשים באופרטור OR . לדוגמה, השאילתות הבאות תקינות:
spaceType = "SPACE"
spaceType = "GROUP_CHAT" OR spaceType = "DIRECT_MESSAGE"
שאילתות לא חוקיות נדחות על ידי השרת עם שגיאה INVALID_ARGUMENT .
|
גוף הבקשה
גוף הבקשה חייב להיות ריק.
גוף התשובה
התשובה לבקשה להצגת רשימת המרחבים המשותפים.
אם הפעולה מצליחה, גוף התגובה מכיל נתונים במבנה הבא:
ייצוג ב-JSON |
{
"spaces": [
{
object (Space )
}
],
"nextPageToken": string
} |
שדות |
spaces[] |
object (Space )
רשימת המרחבים בעמוד המבוקש (או בעמוד הראשון). הערה: השדה permissionSettings לא מוחזר באובייקט המרחב המשותף לבקשות רשימה.
|
nextPageToken |
string
אפשר לשלוח אסימון כ-pageToken כדי לאחזר את דף התוצאות הבא. אם השדה ריק, אין דפים נוספים.
|
היקפי הרשאה
נדרש אחד מהיקפי ההרשאות הבאים של OAuth:
https://www.googleapis.com/auth/chat.spaces
https://www.googleapis.com/auth/chat.spaces.readonly
https://www.googleapis.com/auth/chat.bot
מידע נוסף זמין במדריך ההרשאות.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-25 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-25 (שעון UTC)."],[[["\u003cp\u003eLists spaces (excluding empty group chats and DMs) that the caller is a member of, supporting app and user authentication.\u003c/p\u003e\n"],["\u003cp\u003eAllows filtering by space type and pagination for retrieving large result sets.\u003c/p\u003e\n"],["\u003cp\u003eRequires specific authorization scopes related to Google Chat spaces and bots.\u003c/p\u003e\n"],["\u003cp\u003eProvides details on the HTTP request structure, query parameters, and expected response.\u003c/p\u003e\n"],["\u003cp\u003eTo list all spaces within a Google Workspace organization, use the \u003ccode\u003espaces.search()\u003c/code\u003e method with administrator privileges.\u003c/p\u003e\n"]]],["This document details how to list spaces a user is a member of via an HTTP `GET` request to `https://chat.googleapis.com/v1/spaces`. Key actions include utilizing optional query parameters like `pageSize`, `pageToken`, and `filter` to manage results. The request body must be empty. The response body returns an array of `spaces` and a `nextPageToken` for pagination. Authorization requires specific OAuth scopes, and alternative options exist for listing spaces by Google Workspace organization.\n"],null,["# Method: spaces.list\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.ListSpacesResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nLists spaces the caller is a member of. Group chats and DMs aren't listed until the first message is sent. For an example, see [List spaces](https://developers.google.com/workspace/chat/list-spaces).\n\nSupports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize):\n\n- [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with the authorization scope:\n\n - `https://www.googleapis.com/auth/chat.bot`\n- [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:\n\n - `https://www.googleapis.com/auth/chat.spaces.readonly`\n - `https://www.googleapis.com/auth/chat.spaces`\n\nTo list all named spaces by Google Workspace organization, use the [`spaces.search()`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces/search) method using Workspace administrator privileges instead.\n\n### HTTP request\n\n`GET https://chat.googleapis.com/v1/spaces`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `pageSize` | `integer` Optional. The maximum number of spaces to return. The service might return fewer than this value. If unspecified, at most 100 spaces are returned. The maximum value is 1000. If you use a value more than 1000, it's automatically changed to 1000. Negative values return an `INVALID_ARGUMENT` error. |\n| `pageToken` | `string` Optional. A page token, received from a previous list spaces call. Provide this parameter to retrieve the subsequent page. When paginating, the filter value should match the call that provided the page token. Passing a different value may lead to unexpected results. |\n| `filter` | `string` Optional. A query filter. You can filter spaces by the space type ([`spaceType`](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces#spacetype)). To filter by space type, you must specify valid enum value, such as `SPACE` or `GROUP_CHAT` (the `spaceType` can't be `SPACE_TYPE_UNSPECIFIED`). To query for multiple space types, use the `OR` operator. For example, the following queries are valid: spaceType = \"SPACE\" spaceType = \"GROUP_CHAT\" OR spaceType = \"DIRECT_MESSAGE\" Invalid queries are rejected by the server with an `INVALID_ARGUMENT` error. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nThe response for a list spaces request.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|--------------------------------------------------------------------------------------------------------------------|\n| ``` { \"spaces\": [ { object (/workspace/chat/api/reference/rest/v1/spaces#Space) } ], \"nextPageToken\": string } ``` |\n\n| Fields ||\n|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `spaces[]` | `object (`[Space](/workspace/chat/api/reference/rest/v1/spaces#Space)`)` List of spaces in the requested (or first) page. Note: The `permissionSettings` field is not returned in the Space object for list requests. |\n| `nextPageToken` | `string` You can send a token as `pageToken` to retrieve the next page of results. If empty, there are no subsequent pages. |\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/chat.spaces`\n- `https://www.googleapis.com/auth/chat.spaces.readonly`\n- `https://www.googleapis.com/auth/chat.bot`\n\nFor more information, see the [Authorization guide](/workspace/chat/authenticate-authorize)."]]