Skip to content

Custom Workspace Binding Information



POST /api/v1/workspace/{workspace_uuid}/bind_info/set

Overview

Update a workspace's product display, email copy, or console domain by field.

Prerequisites and Usage Steps

First, check the workspace details to confirm content.bindInfo. Submit only the keys to change. Omit a key to keep its original value; pass an empty string to clear the corresponding override and let the display fall back to the site's default settings. This operation requires write permission. After submission, use Workspace Details to verify content.bindInfo. A domain change can affect links that contain the console address.

Set DF_EXTERNAL_API_URL, DF_EXTERNAL_ACCESS_KEY, and DF_EXTERNAL_SECRET_KEY, then run the example. Replace the example workspace UUID, branding, and configuration values with actual values. The signature version is v20240417.

Route Parameters

Parameter Type Required Description
workspace_uuid string Y Must be a valid workspace UUID for the target site.
Example: wksp_example
How to obtain or enter: Get content.data[].uuid from the workspace list.

Request Headers

Parameter Type Required Description
X-Df-SVersion string Signature version. The following example uses v20240417.
Example: v20240417
How to obtain or enter: Enter it exactly as in the example; it corresponds to the signing 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: Calculate HMAC-SHA256 as in the example over the method, nonce, path, timestamp, and actual JSON bytes sent.
X-Df-Timestamp string Y Timestamp at request time
Example: 1785456000
How to obtain or enter: Enter the current Unix seconds at the time of the call, for example by running date +%s.
X-Df-Nonce string Y Temporary code generated for the request
Example: b53b47e12e514616ad8cb1f17cb66dce
How to obtain or enter: Generate a new random value for each request, for example uuid.uuid4().hex.

Body Request Parameters

Parameter Type Required Description
name string Product display name.
Empty string allowed: True
Example: 示例观测平台
How to obtain or enter: Use the product name you want to display. To clear it, pass an empty string.
companyInfo string Company description.
Empty string allowed: True
Example: 示例公司提供的运维服务
How to obtain or enter: Use the company description you want to show to users of this workspace. To clear it, pass an empty string.
emailHeader string Email header.
Empty string allowed: True
Example: 运维平台通知
How to obtain or enter: Enter the header text as needed for the email. To clear it, pass an empty string.
emailBottom string Email footer.
Empty string allowed: True
Example: 运维平台支持
How to obtain or enter: Enter the footer text as needed for the email. To clear it, pass an empty string.
domain string Console domain, without protocol; may include a port.
Empty string allowed: True
Example: console.example.com
How to obtain or enter: Enter the console domain that has been configured and integrated, for example console.example.com. To clear it, pass an empty string.

Additional Parameter Notes

Use the External API signing credentials assigned to the target site.

Request Example

import hmac
import json
import os
import time
import uuid
import requests

server = os.environ["DF_EXTERNAL_API_URL"].rstrip("/")
path = "/api/v1/workspace/wksp_example/bind_info/set"
method = "POST"
body = json.dumps({'name': '示例观测平台', 'domain': 'console.example.com'}, ensure_ascii=False, separators=(',', ':')).encode('utf-8')
timestamp = str(int(time.time()))
nonce = uuid.uuid4().hex
payload = f"{method} {nonce} {path} {timestamp} ".encode("utf-8") + body
signature = hmac.digest(os.environ["DF_EXTERNAL_SECRET_KEY"].encode(), payload, "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,
    "Content-Type": "application/json",
}
try:
    response = requests.request(method, server + path, headers=headers, data=body, timeout=15)
except requests.RequestException:
    print('请求结果未知,请先核对目标当前状态及是否已经写入,再决定是否重新签名重试;不要自动重复写请求。')
    raise SystemExit(1)
if not 200 <= response.status_code < 300:
    print("HTTP", response.status_code, response.text)  # Keep errorCode, content, and traceId; do not output AK/SK.
    raise SystemExit(1)
data = response.json()["content"]

Response

HTTP 200, application/json.

Field Type Description
content boolean true when the update succeeds.
{
  "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.

HTTP Status errorCode Trigger Condition Message or Response Description Resolution
406 ft.ParameterValidationFailed Field type, required status, or constraints do not match the parameter table Request field validation failed; the message indicates the field or rule. Check the field, type, and constraints.
400 ft.RequestJsonFormatError Invalid request JSON syntax Request JSON format error. Read reason, line, and column in content, then correct the issue.
400 ft.JsonFormatError JSON syntax is valid, but the entire body is not a JSON object JSON format error. Put the parameters in a JSON object enclosed in braces.
401 ft.WKSPNotExistOrReleased The workspace does not exist, has been released, or is in an invalid state The workspace does not exist or has been released. Obtain a valid UUID again from the workspace list on the same site.

Feedback

Is this page helpful?