Usage Limit Query¶
GET /api/v1/workspace/{workspace_uuid}/usage_limit/get
Overview¶
Read the saved usage limit configuration for the specified workspace.
Before Calling and Usage Steps¶
Query using the UUID from the workspace list. If no effective record exists, the response is HTTP 200 with content set to {}. An empty object only means no dedicated limit record was found for the workspace; to determine whether writes can continue, also check the site and product quotas.
The example uses External API signature version v20240417. Set the target site's External API URL, Access Key, and Secret Key to DF_EXTERNAL_API_URL, DF_EXTERNAL_ACCESS_KEY, and DF_EXTERNAL_SECRET_KEY, respectively. Replace the example IDs with actual values.
Path Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| workspace_uuid | string | Y | Target workspace UUID. Example: wksp_exampleHow to obtain or enter: Get it from content.data[].uuid in the Workspace List response and use the original value. |
Request Headers¶
| Parameter | Type | Required | Description |
|---|---|---|---|
| X-Df-SVersion | string | Signature version. The following example uses v20240417. Example: v20240417How to obtain or enter: Enter it exactly as shown in the example, matching the signature algorithm. |
|
| X-Df-Access-Key | string | Y | Request AK information Example: <access-key>How to obtain or enter: Assigned by the External API administrator. |
| X-Df-Signature | string | Y | Signature information Example: <hex-signature>How to obtain or enter: Using the Secret Key, compute HMAC-SHA256 over the text composed of GET, nonce, the request path plus raw query string, timestamp, and an empty string, then take the hexadecimal result. |
| X-Df-Timestamp | string | Y | Timestamp of the request Example: 1785456000How to obtain or enter: Enter the current Unix time in seconds at call time, for example by running date +%s. |
| X-Df-Nonce | string | Y | Nonce generated for the request Example: b53b47e12e514616ad8cb1f17cb66dceHow to obtain or enter: Generate a new random value for each request, for example uuid.uuid4().hex. |
Additional Parameter Notes¶
Use the External API signing credentials assigned to the current target site.
Request Example¶
import hmac
import os
import time
import uuid
from urllib.parse import urlencode
import requests
server = os.environ["DF_EXTERNAL_API_URL"].rstrip("/")
path = "/api/v1/workspace/wksp_example/usage_limit/get"
query = {}
if query:
path += "?" + urlencode(query)
timestamp = str(int(time.time()))
nonce = uuid.uuid4().hex
payload = " ".join(("GET", nonce, path, timestamp, ""))
signature = hmac.digest(os.environ["DF_EXTERNAL_SECRET_KEY"].encode(), payload.encode(), "sha256").hex()
headers = {
"X-Df-Access-Key": os.environ["DF_EXTERNAL_ACCESS_KEY"],
"X-Df-Timestamp": timestamp,
"X-Df-Nonce": nonce,
"X-Df-SVersion": "v20240417",
"X-Df-Signature": signature,
}
try:
result = requests.get(server + path, headers=headers, timeout=15)
except requests.RequestException:
print('读取失败,可退避后重新签名重试,保留traceId及查询条件。')
raise SystemExit(1)
if not 200 <= result.status_code < 300:
print("HTTP", result.status_code, result.text) # Keep errorCode, content, and traceId; do not output AK/SK.
raise SystemExit(1)
data = result.json()["content"]
Response¶
HTTP 200, application/json.
| Field | Type | Description |
|---|---|---|
| content.workspaceUUID | string | Workspace to which the limit belongs. |
| content.keyCode | string | Configuration key; currently UsageLimit. |
| content.config | object | Limit configuration organized by data type, such as logging. Each data type's limit uses its own unit. |
| content.config.<data type>.openLimit | boolean | Whether the limit configuration is enabled for this data type. |
| content.config.<data type>.value | integer | Optional limit value; the unit is determined by the data type. |
{
"code": 200,
"content": {
"workspaceUUID": "wksp_example",
"keyCode": "UsageLimit",
"config": {
"logging": {
"openLimit": true,
"value": 1000
}
}
},
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Response¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
This query has no separate workspace-not-found error; rely on common authentication errors and the actual response content.