Method: spaces.list
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
فضاهایی را که تماس گیرنده عضوی از آنها است را فهرست می کند. تا زمانی که اولین پیام ارسال نشود، چتهای گروهی و پیامهای پیامکی فهرست نمیشوند. برای مثال، لیست فاصله ها را ببینید.
از انواع احراز هویت زیر پشتیبانی می کند:
برای فهرست کردن همه فضاهای نامگذاری شده توسط سازمان Google Workspace، به جای آن از روش spaces.search()
با استفاده از امتیازات سرپرست Workspace استفاده کنید.
درخواست HTTP
GET https://chat.googleapis.com/v1/spaces
URL از دستور GRPC Transcoding استفاده می کند.
پارامترهای پرس و جو
پارامترها |
---|
pageSize | integer اختیاری. حداکثر تعداد فاصله برای بازگشت. ممکن است این سرویس کمتر از این مقدار را برگرداند. اگر نامشخص باشد، حداکثر 100 فاصله برگردانده می شود. حداکثر مقدار 1000 است. اگر از مقداری بیش از 1000 استفاده می کنید، به طور خودکار به 1000 تغییر می کند. مقادیر منفی یک خطای INVALID_ARGUMENT را برمیگرداند. |
pageToken | string اختیاری. یک نشانه صفحه، دریافت شده از یک تماس قبلی در لیست. این پارامتر را برای بازیابی صفحه بعدی ارائه کنید. هنگام صفحهبندی، مقدار فیلتر باید با تماسی که توکن صفحه را ارائه میکند، مطابقت داشته باشد. عبور یک مقدار متفاوت ممکن است منجر به نتایج غیرمنتظره شود. |
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 در شی Space برای درخواستهای فهرست برگردانده نمیشود. |
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 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی."],[[["\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)."]]