Delete Member Group¶
POST /api/v1/mgroup/{group_uuid}/delete
Overview¶
Deletes a backend group and its account and workspace role associations.
Before Calling and Usage Steps¶
First, from the Backend Group List, open both expanded views to verify all members and workspace authorizations, and confirm that these accounts no longer rely on this group to access the relevant workspaces. The request has no body; it deletes one active backend group by group_uuid. This operation soft-deletes the group and active member/workspace role associations, and asynchronously refreshes the permission cache for the relevant workspaces. It does not delete accounts or workspaces, nor does it directly revoke collection Tokens. Permissions obtained by accounts through other direct relationships/groups must be verified separately. Deleting an already nonexistent group again returns 404; this is not an idempotent success. The group/relationship state is committed first, and the permission cache refresh is then dispatched; HTTP 200 does not guarantee that all subsequent requests immediately use the new permissions, and a 500 caused by a dispatch or audit failure may also occur after the principal has been saved. First read the active group list with pagination to confirm whether the target still exists, then verify inherited permissions and cache refresh; if it has been deleted, do not repeat the request. 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 | UUID of an active backend group, not a single-workspace group_ team UUID. Example: mgroup_example001How to obtain or enter: Obtain from content.data[].uuid in the Backend Group List. |
Request Headers¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| X-Df-SVersion | string | Signature version for the original path and request body; do not omit it and continue using the algorithm on this page. Example: v20240417How to obtain or enter: The example on this page uses this fixed version, which is paired with the example signing algorithm. |
|
| X-Df-Access-Key | string | Y | Read APIs can use r or w credentials; write APIs require w credentials. Example: <external-access-key>How to obtain or enter: Assigned by the site administrator as the External API AK; the workspace OpenAPI Key cannot be used. |
| X-Df-Signature | string | Y | Concatenate 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 enter: Calculate using the paired 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: 1785427200How to obtain or enter: At send time, 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: 97d275ee9f774315a7885ba7347acbd9How to obtain or enter: Generate uuid.uuid4().hex again for each request. |
Additional Parameter Notes¶
Use site-level External API AK/SK; for the signing 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 type of object as a group_ team within a single workspace. Write requests require w permission; list operations can use r or w. The group and associations are committed first; a subsequent cache task dispatch or audit failure may still return 500. Query first to confirm whether the group has been deleted before proceeding. When there are no associated workspaces, the shared refresh task receives an empty target list and refreshes the member cache for all active workspaces.
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/delete'
query = {}
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 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 with the standard External application/json envelope; declaration is not added automatically. On success, content=true, and no deletion count is returned; the actual target state must be confirmed by querying.
| Field | Type | Description |
|---|---|---|
| content | boolean | true if the deletion process succeeds; the number of removed members or workspaces is not returned. |
{
"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 return 500 ft.InternalServerError. The group/relationships may have been committed while a subsequent cache or audit failure occurs; read the current state first and do not infer from the error alone that the operation did not take effect.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | Request field is missing, or the field value violates the declared validation conditions | Parameter parsing failed | Verify the parameter location, field name, type, and value. |
| 404 | ft.MGroupNoExists | 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. |
| 500 | ft.InternalServerError | Database, asynchronous cache refresh dispatch, audit, or unhandled field exception | Internal error | Save the traceId, first confirm from the active list whether the target has been deleted, and verify member inherited permissions and cache refresh; if it has been deleted, do not delete it again. |