Method: groups.list
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ดึงข้อมูลกลุ่มทั้งหมดของโดเมนหรือของผู้ใช้ที่ได้รับ userKey (แบ่งเป็นหน้า)
คำขอ HTTP
GET https://admin.googleapis.com/admin/directory/v1/groups
URL ใช้ไวยากรณ์การแปลง gRPC
พารามิเตอร์การค้นหา
พารามิเตอร์ |
customer |
string
รหัสที่ไม่ซ้ำกันสำหรับบัญชี Google Workspace ของลูกค้า ในกรณีที่เป็นบัญชีหลายโดเมน หากต้องการดึงข้อมูลกลุ่มทั้งหมดสำหรับลูกค้า ให้ใช้ช่องนี้แทน domain นอกจากนี้ คุณยังใช้ชื่อแทน my_customer เพื่อแสดง customerId ของบัญชีได้ด้วย ระบบจะแสดง customerId เป็นส่วนหนึ่งของทรัพยากร Users ด้วย คุณต้องระบุพารามิเตอร์ customer หรือ domain
|
domain |
string
ชื่อโดเมน ใช้ฟิลด์นี้เพื่อรับกลุ่มจากโดเมนเดียว หากต้องการแสดงโดเมนทั้งหมดของบัญชีลูกค้า ให้ใช้พารามิเตอร์การค้นหา customer แทน
|
maxResults |
integer
จำนวนผลลัพธ์สูงสุดที่จะแสดง ค่าสูงสุดที่อนุญาตคือ 200
|
orderBy |
enum (OrderBy )
คอลัมน์ที่จะใช้จัดเรียงผลลัพธ์
|
pageToken |
string
โทเค็นสำหรับระบุหน้าถัดไปในรายการ
|
query |
string
การค้นหาสตริงการค้นหา ควรอยู่ในรูปแบบ "" เอกสารประกอบฉบับเต็มอยู่ที่ https: //developers.google.com/workspace/admin/directory/v1/guides/search-groups
|
sortOrder |
enum (SortOrder )
แสดงผลลัพธ์ตามลําดับจากน้อยไปมากหรือมากไปน้อย มีประโยชน์เฉพาะเมื่อใช้ orderBy ด้วย
|
userKey |
string
อีเมลหรือรหัสที่ไม่เปลี่ยนแปลงของผู้ใช้ หากต้องการแสดงเฉพาะกลุ่มที่ผู้ใช้รายนั้นเป็นสมาชิก หากเป็นรหัส รหัสดังกล่าวควรตรงกับรหัสของออบเจ็กต์ผู้ใช้ ใช้กับพารามิเตอร์ customer ไม่ได้
|
เนื้อหาของคำขอ
เนื้อหาของคำขอต้องว่างเปล่า
เนื้อหาการตอบกลับ
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีข้อมูลซึ่งมีโครงสร้างดังต่อไปนี้
การแสดง JSON |
{
"kind": string,
"etag": string,
"groups": [
{
object (Group )
}
],
"nextPageToken": string
} |
ช่อง |
kind |
string
ประเภทของทรัพยากร
|
etag |
string
ETag ของทรัพยากร
|
groups[] |
object (Group )
รายการออบเจ็กต์กลุ่ม
|
nextPageToken |
string
โทเค็นที่ใช้เข้าถึงหน้าถัดไปของผลการค้นหานี้
|
ขอบเขตการให้สิทธิ์
ต้องใช้ขอบเขต OAuth ต่อไปนี้
https://apps-apis.google.com/a/feeds/groups/
https://www.googleapis.com/auth/admin.directory.group
https://www.googleapis.com/auth/admin.directory.group.readonly
ดูข้อมูลเพิ่มเติมได้ที่คู่มือการให้สิทธิ์
SortOrder
Enum |
ASCENDING |
เรียงลำดับจากน้อยไปมาก |
DESCENDING |
เรียงลำดับจากมากไปน้อย |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[],[],null,["# Method: groups.list\n\nRetrieves all groups of a domain or of a user given a userKey (paginated).\n\n### HTTP request\n\n`GET https://admin.googleapis.com/admin/directory/v1/groups`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `customer` | `string` The unique ID for the customer's Google Workspace account. In case of a multi-domain account, to fetch all groups for a customer, use this field instead of `domain`. You can also use the `my_customer` alias to represent your account's `customerId`. The `customerId` is also returned as part of the [Users](https://developers.google.com/workspace/admin/directory/v1/reference/users) resource. You must provide either the `customer` or the `domain` parameter. |\n| `domain` | `string` The domain name. Use this field to get groups from only one domain. To return all domains for a customer account, use the `customer` query parameter instead. |\n| `maxResults` | `integer` Maximum number of results to return. Max allowed value is 200. |\n| `orderBy` | `enum (`[OrderBy](/workspace/admin/directory/reference/rest/v1/groups/list#OrderBy)`)` Column to use for sorting results |\n| `pageToken` | `string` Token to specify next page in the list |\n| `query` | `string` Query string search. Should be of the form \"\". Complete documentation is at https: //developers.google.com/workspace/admin/directory/v1/guides/search-groups |\n| `sortOrder` | `enum (`[SortOrder](/workspace/admin/directory/reference/rest/v1/groups/list#SortOrder)`)` Whether to return results in ascending or descending order. Only of use when orderBy is also used |\n| `userKey` | `string` Email or immutable ID of the user if only those groups are to be listed, the given user is a member of. If it's an ID, it should match with the ID of the user object. Cannot be used with the `customer` parameter. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"kind\": string, \"etag\": string, \"groups\": [ { object (/workspace/admin/directory/reference/rest/v1/groups#Group) } ], \"nextPageToken\": string } ``` |\n\n| Fields ||\n|-----------------|----------------------------------------------------------------------------------------------------------|\n| `kind` | `string` Kind of resource this is. |\n| `etag` | `string` ETag of the resource. |\n| `groups[]` | `object (`[Group](/workspace/admin/directory/reference/rest/v1/groups#Group)`)` A list of group objects. |\n| `nextPageToken` | `string` Token used to access next page of this result. |\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://apps-apis.google.com/a/feeds/groups/`\n- `\n https://www.googleapis.com/auth/admin.directory.group`\n- `\n https://www.googleapis.com/auth/admin.directory.group.readonly`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent).\n\nOrderBy\n-------\n\n| Enums ||\n|---------|---------------------|\n| `EMAIL` | Email of the group. |\n\nSortOrder\n---------\n\n| Enums ||\n|--------------|-------------------|\n| `ASCENDING` | Ascending order. |\n| `DESCENDING` | Descending order. |"]]