从模板创建服务
下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数。
参数 | 类型 | 是否必填 | 示例值 | 描述 |
|---|---|---|---|---|
Action | String | 是 | CreateServiceFromTemplate | 要执行的操作,取值:CreateServiceFromTemplate。 |
Version | String | 是 | 2025-10-30 | API的版本,取值:2025-10-30。 |
TemplateId | String | 是 | tpl_vikingdb_001 | 服务模板ID @example:tpl_vikingdb_001 |
ServiceName | String | 是 | my-vikingdb-service | 服务名称,1-64字符 @example:my-vikingdb-service |
PermissionSpaceId | String | 是 | ps_123456 | 权限空间ID @example:ps_123456 |
PermissionSpaceName | String | 否 | "我的权限空间" | 权限空间名称 @example:"我的权限空间" |
Description | String | 否 | "VikingDB向量搜索服务" | 服务描述 @example:"VikingDB向量搜索服务" |
RouteTemplateIds | Array of String | 否 | example | 要创建的路由模板ID列表,不传则创建模板下所有路由 |
ProjectName | String | 否 | default | 项目名称(可选),默认值 default @example:default |
Tags | Array of Object | 否 | [{"Key": "tag1", "Value": "value1"}, {"Key": "tag2", "Value": "value2"}] | 标签(可选)@example: [{"Key": "tag1", "Value": "value1"}, {"Key": "tag2", "Value": "value2"}] |
下表仅列出本接口特有的返回参数。更多信息请参见返回结构。
参数 | 类型 | 示例值 | 描述 |
|---|---|---|---|
Trn | String | trn:id:cn-beijing:1234567890:gatewayservice/svc-12345 | TRN @example:trn:id:cn-beijing:1234567890:gatewayservice/svc-12345 |
Tags | Array of Object | [{Key: "app", Value: "test"}] | 标签列表 @example:[{Key: "app", Value: "test"}] |
Status | String | ACTIVE | 服务状态 @example:ACTIVE |
Backend | Object | example | 后端服务配置 |
CreatedAt | Long | 1701504000000 | 创建时间(Unix时间戳毫秒) @example:1701504000000 |
ServiceId | String | svc-1234567890 | 服务ID @example:svc-1234567890 |
UpdatedAt | Long | 1701504000000 | 更新时间(Unix时间戳毫秒) @example:1701504000000 |
RouteCount | Integer | 5 | 路由数量 @example:5 |
TemplateId | String | tpl_vikingdb_001 | 内置服务关联的模板ID @example:tpl_vikingdb_001 |
BackendType | String | viking | 后端服务类型:custom, viking, agentkit-mcp @example:viking |
Description | String | "用于VikingDB向量搜索的权限网关" | 服务描述 @example:"用于VikingDB向量搜索的权限网关" |
ProjectName | String | my-project | 项目名称 @example:my-project |
ServiceName | String | my-vikingdb-service | 服务名称,在账号下唯一 @example:my-vikingdb-service |
PermissionSpaceId | String | ps_123456 | 权限空间ID @example:ps_123456 |
HijackDomainPublic | String | api.example.com | 公网域名 @example:api.example.com |
HijackDomainPrivate | String | api.example.com | 内网域名 @example:api.example.com |
PermissionSpaceName | String | "我的权限空间" | 权限空间名称 @example:"我的权限空间" |
POST { "TemplateId": "tpl_vikingdb_001", "ServiceName": "my-vikingdb-service", "PermissionSpaceId": "ps_123456", "PermissionSpaceName": "\"我的权限空间\"", "Description": "\"VikingDB向量搜索服务\"", "RouteTemplateIds": [ "" ] }
{ "ResponseMetadata": { "Action": "CreateServiceFromTemplate", "Region": "cn-north-1", "Service": "***", "Version": "2025-10-30", "RequestId": "20230604110420****100232280022D31" }, "Result": { "Status": null, "Backend": { "Protocol": "HTTPS", "EnableTls": true, "BackendPort": 443, "BackendDomain": "api.example.com", "TimeoutSeconds": 30 }, "CreatedAt": 1701504000000, "ServiceId": "svc-1234567890", "UpdatedAt": 1701504000000, "RouteCount": 5, "TemplateId": "tpl_vikingdb_001", "BackendType": null, "Description": "\"用于VikingDB向量搜索的权限网关\"", "ServiceName": "my-vikingdb-service", "PermissionSpaceId": "ps_123456", "HijackDomainPublic": "api.example.com", "HijackDomainPrivate": "api.example.com", "PermissionSpaceName": "\"我的权限空间\"" } }
下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。
状态码 | 错误码 | 说明 |
|---|---|---|
400 | InvalidParameter | 参数 %s 无效 |
404 | NotFound | 资源 %s 不存在 |
409 | StatusConflict | 状态冲突: %s |
409 | Duplicated | 资源 %s 已存在 |
422 | ParseFailed | 文档解析失败: %s |
429 | QuotaExceeded | 配额 %s 已达上限 |
500 | InternalError | 内部服务错误: %s |
501 | NotImplemented | 功能未实现: %s |
502 | UpstreamUnreachable | 后端服务 %s 不可达 |