创建连接器开放策略接口
将 <BASE_URL> 替换为所在企业环境的 API 域名。
- Scope:
admin.v1.connectors.manage - 权限项:连接器管理(
connectors) - 权限类型:管理
- 接口:POST
/api/openapi/v1/connector-policies
认证与请求头
使用应用 API Key 调用。当前接口只校验上方独立 Scope;读取、管理与执行权限互不隐含。
| 名称 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
Authorization | header | string | 是 | 应用 API Key,使用 Bearer 方式传递。 | Bearer qwk_*** |
X-Request-Id | header | string | 否 | 可选的调用追踪标识;未传入时由服务端生成。 | req-20260831-001 |
请求参数
| 名称 | 位置 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|---|
Idempotency-Key | header | string | 必填 | - | "<string>" |
description | body | string | 否 | - | "<string>" |
display_order | body | integer · int64 | 否 | - | 0 |
mode | body | string | 必填 | - | "allowlist" |
name | body | string | 必填 | - | "<string>" |
resource_ids | body | array | null | 必填 | - | ["<string>"] |
resource_scope | body | string | 必填 | - | "all" |
status | body | string | 否 | - | "enabled" |
subject_scope | body | string | 必填 | - | "all_users" |
subjects | body | array | null | 必填 | - | [{"include_descendants":false,"subject_id":"<string>","subject_type":"user"}] |
surfaces | body | array | null | 必填 | - | ["<string>"] |
valid_from | body | string · date-time | 否 | - | "2026-08-27T10:00:00Z" |
valid_to | body | string · date-time | 否 | - | "2026-08-27T10:00:00Z" |
请求示例
cURL
curl --request POST \
--url '<BASE_URL>/api/openapi/v1/connector-policies' \
--header 'Authorization: Bearer <API_KEY>' \
--header 'Idempotency-Key: <UNIQUE_REQUEST_ID>' \
--header 'Content-Type: application/json' \
--data '{
"description": "<string>",
"display_order": 0,
"mode": "allowlist",
"name": "<string>",
"resource_ids": [
"<string>"
],
"resource_scope": "all",
"status": "enabled",
"subject_scope": "all_users",
"subjects": [
{
"include_descendants": false,
"subject_id": "<string>",
"subject_type": "user"
}
],
"surfaces": [
"<string>"
],
"valid_from": "2026-08-27T10:00:00Z",
"valid_to": "2026-08-27T10:00:00Z"
}'响应
201 Created
| 名称 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
created_at | string · date-time | 是 | - | "2026-08-27T10:00:00Z" |
default | boolean | 是 | - | false |
description | string | 是 | - | "<string>" |
id | string | 是 | - | "<string>" |
mode | string | 是 | - | "<string>" |
name | string | 是 | - | "<string>" |
policy_type | string | 是 | - | "<string>" |
resource_count | integer · int64 | 是 | - | 0 |
resource_scope | string | 是 | - | "<string>" |
status | string | 是 | - | "<string>" |
subject_count | integer · int64 | 是 | - | 0 |
subject_counts | object | 是 | - | {} |
subject_scope | string | 是 | - | "<string>" |
surfaces | array | null | 是 | - | ["<string>"] |
updated_at | string · date-time | 是 | - | "2026-08-27T10:00:00Z" |
响应示例
{
"created_at": "2026-08-27T10:00:00Z",
"default": false,
"description": "<string>",
"id": "<string>",
"mode": "<string>",
"name": "<string>",
"policy_type": "<string>",
"resource_count": 0,
"resource_scope": "<string>",
"status": "<string>",
"subject_count": 0,
"subject_counts": {},
"subject_scope": "<string>",
"surfaces": [
"<string>"
],
"updated_at": "2026-08-27T10:00:00Z"
}default Flat business error
| 名称 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
code | string | 否 | Stable business error code | "<string>" |
detail | string | 是 | Human-readable error description | "<string>" |
details | OpenapiErrorDetails | 否 | - | {"field":"<string>","reason":"<string>","suggestion":"<string>"} |
details.field | string | 否 | Request field that failed validation | "<string>" |
details.reason | string | 否 | Stable validation failure reason | "<string>" |
details.suggestion | string | 否 | Suggested normalized value | "<string>" |
error | string | 是 | Stable HTTP error type | "<string>" |
响应示例
{
"code": "<string>",
"detail": "<string>",
"details": {
"field": "<string>",
"reason": "<string>",
"suggestion": "<string>"
},
"error": "<string>"
}