Skip to content

Modify Member Group



POST /api/v1/mgroup/{group_uuid}/modify

Overview

Modify the backend group name and reset members with a complete account list.

Before Calling and Usage Steps

First call Backend Group List with showMembers enabled to save the existing complete member set, then submit the target list. This is a full replacement, not an incremental append: once accountUUIDs appears, old member relations that are not listed are removed. Omitting accountUUIDs keeps the members; null or [] clears the members; when only modifying the name, do not carry an empty array. Omitting name keeps the name; omitting both can return true without changing relations. Removing members from a backend group changes the workspace access/roles they inherit through that group; it does not delete the account itself or its other direct member relations. The group/relation state is submitted first, and then the permission cache refresh is delivered; HTTP 200 does not guarantee that all subsequent requests already use the new permissions immediately, and a 500 caused by delivery or audit failure may also occur after the main entity is saved. First read the list by pagination and locate the entry by uuid, expand the complete members/refWorkspaces to verify the saved state, and then decide whether an additional modification or cache refresh is needed. When the refresh target list is empty, the shared task refreshes all active workspaces; this must not be understood as refreshing only the current group.

Route Parameters

Parameter Type Required Description
group_uuid string Y Active backend group UUID, not a single-workspace group_ team UUID.
Example: mgroup_example001
How to obtain or fill: Obtain from content.data[].uuid of Backend Group List.

Request Headers

Parameter Type Required Description
X-Df-SVersion string Signature version of the raw path and request body; you cannot omit it and keep using the algorithm on this page.
Example: v20240417
How to obtain or fill: This page's example uses this fixed version, which 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: The site administrator assigns an External API AK; a workspace OpenAPI Key cannot be used.
X-Df-Signature string Y HMAC-SHA256 over the uppercase method, nonce, raw full path, timestamp, and raw UTF-8 request body joined by spaces, then take the hex digest.
Example: <hmac-sha256-hex>
How to obtain or fill: Compute with 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: Generate the current Unix seconds string with str(int(time.time())) when sending.
X-Df-Nonce string Y Temporary serial number; generate a new value and recompute the signature even when resending after a failure.
Example: 97d275ee9f774315a7885ba7347acbd9
How to obtain or fill: Regenerate uuid.uuid4().hex for each request.

Body Request Parameters

Parameter Type Required Description
accountUUIDs[*] string A single account UUID string, not an email or workspace UUID.
Example: acnt_example001
How to obtain or fill: Obtain a single account from content.data[].uuid of Site Account List.
name string Optional, maximum 256 characters; cannot be null, and a non-empty name is recommended.
Null allowed: False
Maximum length: 256
Example: 示例研发分组新名称
How to obtain or fill: Fill in the new name as needed; omit it to keep the current name.
accountUUIDs array Complete array of account UUIDs, deduplicated as a set; the caller must pre-validate that the accounts exist and have the required state, because the endpoint does not actively filter out all unknown/deleted accounts. Omit to keep; explicit null or [] clears all members; a non-empty array fully replaces them.
Null allowed: True
Example: ["acnt_example001"]
How to obtain or fill: Obtain real accounts from content.data[].uuid of Site Account List, and verify their state first.

Additional Notes on Parameters

Use a site-level External API AK/SK; for the signature method, see External API Signature Authentication. A backend group mgroup_ can be associated with multiple workspaces and grant inherited roles; it is not the same kind of object as a group_ team within a single workspace. Write requests require w permission; list operations can use r or w. After members change, the member permission caches of the related workspaces are refreshed asynchronously; HTTP 200 does not mean that all sessions have already consumed the new permissions. The group entity updateAt is not guaranteed to reflect pure member changes.

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 = 'POST'
path = '/api/v1/mgroup/mgroup_example001/modify'
query = {}
data = {'name': '示例研发分组新名称', 'accountUUIDs': ['acnt_example001']}
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"))  # Judge by errorCode, content, and traceId; do not output the AK/SK.
    raise SystemExit(1)
except (URLError, TimeoutError):
    print('请求结果未知,请先查询实际配置及任务状态,再决定是否重试写请求。')
    raise SystemExit(1)
print(json.dumps(payload, ensure_ascii=False, indent=2))

Response

HTTP 200, application/json standard External envelope; declaration is not added automatically. On success content=true, and the full group profile is not returned.

Field Type Description
content boolean true on success, with no per-account result; it can also be true when no change fields are submitted.
{
  "code": 200,
  "content": true,
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

Error Responses

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

The table lists verified request and business errors; ordinary internal exceptions ultimately become 500 ft.InternalServerError. The group/relation may already be committed while a subsequent cache or audit operation fails, so read the current state first and do not infer that nothing took effect based solely on the error.

HTTP Status errorCode Trigger Condition Message or Response Description Handling
406 ft.ParameterValidationFailed A 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.
400 ft.RequestJsonFormatError The request JSON syntax is invalid Request JSON format error Fix the JSON according to content.reason, line, and column.
400 ft.JsonFormatError The JSON top level is not an object Some json file format error Submit a JSON object as described in the table.
404 ft.MGroupNoExists The group UUID does not exist or the group has been deleted Group does not exist Obtain the uuid of an active mgroup_ record from the Backend Group List.
400 ft.MGroupNameExists An active backend group with the same name already exists A group with the same name already exists Check the list first and choose a name that is not duplicated; modify the existing group instead of creating it again.
500 ft.InternalServerError Database, asynchronous cache refresh delivery, audit, or an unhandled field exception Internal error Save the traceId, read back the saved state by expanding members/refWorkspaces from the list by uuid, and then decide whether an additional modification or permission cache refresh is needed.

Feedback

Is this page helpful?