You need to enable JavaScript to run this app.
智能体身份和权限管理平台

智能体身份和权限管理平台

复制全文
权限网关
BatchCreateRoutes - 批量创建路由
复制全文
BatchCreateRoutes - 批量创建路由

批量创建路由

调试

请求参数

下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数

参数
类型
是否必填
示例值
描述
Action
String

BatchCreateRoutes

要执行的操作,取值:BatchCreateRoutes。

Version
String

2025-10-30

API的版本,取值:2025-10-30。

ServiceName
String

my-vikingdb-service

服务名称 @example:my-vikingdb-service

Routes
Array of Object

example

路由列表,最多50条

Mode
Integer

SKIP

批量创建模式,默认 SKIP @example:SKIP

返回参数

下表仅列出本接口特有的返回参数。更多信息请参见返回结构

参数
类型
示例值
描述
Failed
Array of Object

example

失败的路由列表及原因

Created
Array of Object

example

成功创建的路由列表

Deleted
Array of String

example

删除的路由名称列表(Sync 模式)

Skipped
Array of String

example

跳过的路由名称列表(Skip 模式,已存在)

Updated
Array of Object

example

成功更新的路由列表(Upsert/Sync 模式)

请求示例

POST
{
    "ServiceName": "my-vikingdb-service",
    "Routes": [
        {
            "Path": "/api/v1/collection/:collection_name/search",
            "Method": "POST",
            "ApiSpec": {
                "ActionType": "READ",
                "Extractors": [
                    {
                        "Path": "/collection_name",
                        "IsAuth": false,
                        "Source": null,
                        "ResourceType": "Collection"
                    }
                ],
                "ActionValue": "search",
                "IdentifierType": null,
                "IdentifierValue": "/collection_name",
                "ResponseFilters": [
                    {
                        "Mode": null,
                        "IsAuth": false,
                        "IdField": "id",
                        "Attributes": [
                            {
                                "Field": "/id",
                                "Target": "ResourceId"
                            }
                        ],
                        "FilterPath": "/data/items",
                        "ResourcePath": "/data",
                        "ResourceType": "Collection"
                    }
                ]
            },
            "Priority": 100,
            "RouteName": "SearchVectors",
            "Description": "\"向量搜索接口\"",
            "ResourceType": "Collection",
            "PathMatchType": "Exact",
            "PermissionPool": "VikingDB",
            "AuthResourceType": "Collection"
        }
    ],
    "Mode": null
}

返回示例

{
    "ResponseMetadata": {
        "Action": "BatchCreateRoutes",
        "Region": "cn-north-1",
        "Service": "***",
        "Version": "2025-10-30",
        "RequestId": "20230604110420****100232280022D31"
    },
    "Result": {
        "Failed": [
            {
                "Code": "",
                "Message": "",
                "RouteName": ""
            }
        ],
        "Created": [
            {
                "Path": "/api/v1/collection/:collection_name/search",
                "Method": "POST",
                "Status": null,
                "ApiSpec": {
                    "ActionType": "READ",
                    "Extractors": [
                        {
                            "Path": "/collection_name",
                            "IsAuth": true,
                            "Source": null,
                            "ResourceType": "Collection"
                        }
                    ],
                    "ActionValue": "search",
                    "IdentifierType": null,
                    "IdentifierValue": "/collection_name",
                    "ResponseFilters": [
                        {
                            "Mode": null,
                            "IsAuth": false,
                            "IdField": "id",
                            "Attributes": [
                                {
                                    "Field": "/id",
                                    "Target": "ResourceId"
                                }
                            ],
                            "FilterPath": "/data/items",
                            "ResourcePath": "/data",
                            "ResourceType": "Collection"
                        }
                    ]
                },
                "Priority": 100,
                "CreatedAt": 1701504000000,
                "RouteName": "SearchVectors",
                "UpdatedAt": 1701504000000,
                "Description": "\"向量搜索接口\"",
                "ResourceType": "Collection",
                "PathMatchType": "EXACT",
                "PermissionPool": "VikingDB",
                "AuthResourceType": "Collection",
                "SourceTemplateId": "rt_vikingdb_search_001"
            }
        ],
        "Deleted": [
            ""
        ],
        "Skipped": [
            ""
        ],
        "Updated": []
    }
}

错误码

下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。

状态码
错误码
错误信息
说明
400
InvalidParameter

Invalid request parameters: %s.

参数 %s 无效

404
NotFound

Resource not found: %s.

资源 %s 不存在

409
Duplicated

Resource already exists: %s.

资源 %s 已存在

409
StatusConflict

Status conflict: %s.

状态冲突: %s

422
ParseFailed

Failed to parse document: %s.

文档解析失败: %s

429
QuotaExceeded

Quota exceeded: %s.

配额 %s 已达上限

500
InternalError

Internal server error: %s.

内部服务错误: %s

501
NotImplemented

Not implemented: %s.

功能未实现: %s

502
UpstreamUnreachable

Upstream unreachable: %s.

后端服务 %s 不可达

最近更新时间:2025.12.14 13:43:21
这个页面对您有帮助吗?
有用
有用
无用
无用