Skip to content

Get Member Group List



GET /api/v1/mgroup/list

Overview

Lists site backend groups with pagination and can expand accounts and cross-workspace roles.

Before Calling and Usage Steps

Returns active groups in descending order of creation time. By default, members or refWorkspaces are not included; enable them with showMembers and showRefWorkspace respectively. When disabled, the corresponding fields are omitted rather than being empty arrays. The member summary includes only accounts that can be resolved, and the accounts' own statuses are not uniformly restricted to enabled; the associated workspace may also have been deleted, so determine based on each status. Role summaries filter out invalid roles. The list is not a team list for a single workspace and does not provide exact queries by groupUUID. Search by name and then use the returned uuid to confirm the target.

Request Headers

Parameter Name Type Required Description
X-Df-SVersion string Signature version for the original path and request body; you cannot omit it and continue using the algorithm on this page.
Example: v20240417
How to obtain or fill in: The example on this page uses this fixed version and is paired with the example signature algorithm.
X-Df-Access-Key string Y Read endpoints can use r or w credentials; write endpoints require w credentials.
Example: <external-access-key>
How to obtain or fill in: Assigned by the site administrator as an External API AK; workspace OpenAPI Keys cannot be used.
X-Df-Signature string Y Join the uppercase method, nonce, original full path, timestamp, and original UTF-8 request body with spaces, then compute HMAC-SHA256 and take the hex digest.
Example: <hmac-sha256-hex>
How to obtain or fill in: Calculate using the matching SK according to External API Signature Authentication; see the complete runnable template below.
X-Df-Timestamp string Y Must be within the signature validity window configured for the site; do not reuse the example time.
Example: 1785427200
How to obtain or fill in: When sending, use str(int(time.time())) to generate the current Unix seconds string.
X-Df-Nonce string Y Temporary serial number; when resending after a failure, also generate a new value and recalculate the signature.
Example: 97d275ee9f774315a7885ba7347acbd9
How to obtain or fill in: Regenerate uuid.uuid4().hex for each request.

Query Request Parameters

Parameter Name Type Required Description
showMembers boolean Optional; the string true/1 (case-insensitive and ignoring leading/trailing whitespace) enables it; other values disable it. Default: false.
Nullable: False
Example: true
How to obtain or fill in: Use true or 1 in the URL query to enable account expansion; omit it when not needed.
showRefWorkspace boolean Optional; the string true/1 enables it; other values disable it. Default: false.
Nullable: False
Example: true
How to obtain or fill in: Use true or 1 in the URL query to enable workspace and role expansion.
search string Optional; after trimming leading and trailing whitespace, performs a contains match on the group name. If omitted or blank, no filtering is applied.
Nullable: False
Example: 研发
How to obtain or fill in: Enter a keyword from the backend group name.
pageIndex integer Default 1, minimum 1.
Nullable: False
$minValue: 1
Example: 1
How to obtain or fill in: Starts at 1; use content.pageInfo to advance to subsequent pages.
pageSize integer Default 20, maximum 1000.
Nullable: False
$minValue: 1
$maxValue: 1000
Example: 20
How to obtain or fill in: Choose 1 to 1000 according to client needs; when expanding members/workspaces, it is recommended to limit the number per page.

Additional Parameter Notes

Use a site-level External API AK/SK. For the signing method, see External API Signature Authentication. A backend group with the mgroup_ prefix can be associated with multiple workspaces and granted inherited roles; it is not the same type of object as a group_ team within a single workspace. Write requests require w permission; list requests can use r or w.

Request Example

import hashlib
import hmac
import json
import time
import uuid
from urllib.parse import urlencode
from urllib.request import Request, urlopen
from urllib.error import HTTPError, URLError

# Replace with the target site address and the External API AK/SK assigned by the administrator.
server = "https://external-api.guance.com"
access_key = "<external-access-key>"
secret_key = "<external-secret-key>"
method = 'GET'
path = '/api/v1/mgroup/list'
query = {'search': '研发', 'showMembers': 'true', 'showRefWorkspace': 'true', 'pageIndex': 1, 'pageSize': 20}
data = None
full_path = path + ("?" + urlencode(query) if query else "")
body = "" if data is None else json.dumps(data, ensure_ascii=False, separators=(",", ":"))
timestamp = str(int(time.time()))
nonce = uuid.uuid4().hex
string_to_sign = " ".join([method, nonce, full_path, timestamp, body])
signature = hmac.new(secret_key.encode("utf-8"), string_to_sign.encode("utf-8"), hashlib.sha256).hexdigest()
headers = {
    "X-Df-Access-Key": access_key,
    "X-Df-Timestamp": timestamp,
    "X-Df-Nonce": nonce,
    "X-Df-Signature": signature,
    "X-Df-SVersion": "v20240417",
}
if data is not None:
    headers["Content-Type"] = "application/json"
request = Request(server + full_path, data=None if data is None else body.encode("utf-8"), headers=headers, method=method)
try:
    with urlopen(request, timeout=30) as result:
        payload = json.loads(result.read().decode("utf-8"))
except HTTPError as error:
    print("HTTP", error.code, error.read().decode("utf-8"))  # Determine based on errorCode, content, and traceId; do not output AK/SK.
    raise SystemExit(1)
except (URLError, TimeoutError):
    print('读取失败,可以退避后重新签名重试;保留traceId与查询条件。')
    raise SystemExit(1)
print(json.dumps(payload, ensure_ascii=False, indent=2))

Response

HTTP 200, application/json standard External envelope, with no automatic addition of declaration. content is a paginated object containing data and pageInfo.

Field Type Description
content.data Array of objects Backend groups on the current page; [] when there are no results.
content.data[].id integer or null Record sequence number; calls use uuid. The creation snapshot is obtained before flush, so id may be null.
content.data[].uuid string Backend group UUID, usually prefixed with mgroup_.
content.data[].status integer 0 for active groups; deleted groups are filtered out of the list.
content.data[].creator string Creation identity; usually sys for External.
content.data[].updator string Last modification identity; may be empty if never modified.
content.data[].createAt integer Creation Unix seconds.
content.data[].deleteAt integer Deletion Unix seconds; usually -1 if not deleted.
content.data[].updateAt integer Group entity update time; usually -1 if not yet modified. Changing only members/workspace roles is not guaranteed to synchronously update the entity time, so this cannot be used to determine whether authorization has changed.
content.data[].name string Backend group display name.
content.data[].members Array of objects Present only when showMembers is enabled; accounts that cannot be resolved are omitted.
content.data[].members[].uuid string Account UUID, which can be used as an element of accountUUIDs.
content.data[].members[].status integer The account's own status, which may include disabled/deleted statuses; being displayed does not mean the account can log in.
content.data[].members[].wsAccountStatus integer Workspace relationship status in the identity summary; this list does not specify a single workspace, so it is usually 3 and cannot be used to determine group authorization failure.
content.data[].members[].username string Account login name.
content.data[].members[].name string Display nickname.
content.data[].members[].iconUrl string Avatar URL; can be empty when there is no avatar.
content.data[].members[].email string Account email.
content.data[].members[].mobile string Account mobile number.
content.data[].members[].countryCode string Mobile country code.
content.data[].members[].acntWsNickname string Workspace nickname in the identity summary; usually empty in this site list.
content.data[].refWorkspaces Array of objects Present only when showRefWorkspace is enabled; contains a summary of valid roles in each workspace.
content.data[].refWorkspaces[].uuid string Associated workspace UUID; the field name in write requests is workspaceUUID.
content.data[].refWorkspaces[].name string or null Associated workspace name; can be null when the record is missing.
content.data[].refWorkspaces[].status integer or null Workspace status, including possible deleted status 3; can be null when no workspace record is found.
content.data[].refWorkspaces[].roles Array of objects Summary of valid roles; deleted/unresolvable roles do not appear in the summary. Do not mistake this for the association table having no historical records.
content.data[].refWorkspaces[].roles[].uuid string Role UUID.
content.data[].refWorkspaces[].roles[].name string Role display name.
content.pageInfo.pageIndex integer Current page number.
content.pageInfo.pageSize integer Number of items per page.
content.pageInfo.count integer Number of groups on this page.
content.pageInfo.totalCount integer Total number of groups after filtering.
{
  "code": 200,
  "content": {
    "data": [
      {
        "id": 1001,
        "uuid": "mgroup_example001",
        "status": 0,
        "creator": "sys",
        "updator": "",
        "createAt": 1785427200,
        "deleteAt": -1,
        "updateAt": -1,
        "name": "示例研发分组",
        "members": [
          {
            "uuid": "acnt_example001",
            "status": 0,
            "wsAccountStatus": 3,
            "username": "xxx@guance.com",
            "name": "示例成员",
            "iconUrl": "",
            "email": "xxx@guance.com",
            "mobile": "",
            "countryCode": "",
            "acntWsNickname": ""
          }
        ],
        "refWorkspaces": [
          {
            "uuid": "wksp_example001",
            "name": "示例空间",
            "status": 0,
            "roles": [
              {
                "uuid": "readOnly",
                "name": "ReadOnly"
              }
            ]
          }
        ]
      }
    ],
    "pageInfo": {
      "pageIndex": 1,
      "pageSize": 20,
      "count": 1,
      "totalCount": 1
    }
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

When expansion is not enabled, each group returns only the basic entity fields:

{
  "code": 200,
  "content": {
    "data": [
      {
        "id": 1001,
        "uuid": "mgroup_example001",
        "status": 0,
        "creator": "sys",
        "updator": "",
        "createAt": 1785427200,
        "deleteAt": -1,
        "updateAt": -1,
        "name": "示例研发分组"
      }
    ],
    "pageInfo": {
      "pageIndex": 1,
      "pageSize": 20,
      "count": 1,
      "totalCount": 1
    }
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

When there are no matches, data=[], and pagination count/totalCount are 0.

Error Response

For authentication, rate limiting, and common request errors, see Common Error Definitions.

The table lists verified request and read errors; ordinary database, cache read, or result formatting exceptions ultimately result in 500 ft.InternalServerError. This API only reads and does not update groups or relationships.

HTTP Status errorCode Trigger Condition Message or Response Description Handling
406 ft.ParameterValidationFailed Request field is missing, or a field value violates the declared validation conditions Parameter parsing failed Check the parameter location, field name, type, and value.
500 ft.InternalServerError Database, cache read, or list field formatting exception Internal error Keep the traceId and retry a limited number of times later; if the failure persists, ask the administrator to check the read path.

Feedback

Is this page helpful?