You need to enable JavaScript to run this app.
文档中心
API 网关

API 网关

复制全文
下载 pdf
路由管理
CreateGatewayService - 创建服务
复制全文
下载 pdf
CreateGatewayService - 创建服务
为网关实例创建服务。​
请求说明​
API 网关已在全球多个地域部署服务,旨在为您提供更稳定、低延迟的访问体验。您可以通过查阅 服务地址 文档,根据业务所在地域,选择最合适的接入点。​
  • 请求方式:POST​
  • 请求地址:https://apig.cn-beijing.volcengineapi.com?Action=CreateGatewayService&Version=2021-03-03​
调试​
API Explorer
您可以通过 API Explorer 在线发起调用,无需关注签名生成过程,快速获取调用结果。
​
请求参数​
​
参数​
类型​
是否必选​
示例值​
描述​
Action​
String​
是​
CreateGatewayService​
接口名称。当前 API 的名称为 CreateGatewayService。​
Version​
String​
是​
2021-03-03​
接口版本。当前 API 的版本为 2021-03-03。​
ServiceName​
String​
是​
example​
服务名称。​
  • 支持大小写字母、数字和中划线(-),长度限制为2~128个字符。​
  • 不能以中划线(-)开头。​
GatewayId​
String​
是​
gd8****​
网关实例 ID。您可以通过 ListGateways 查询网关实例 ID。​
Protocol​
Array of String​
是​
["HTTP","HTTPS"]​
协议类型,取值:​
  • HTTP。​
  • HTTPS。​
AuthSpec​
Object of AuthSpec​
是​
-​
认证配置。建议使用插件中心中的认证鉴权插件进行服务认证。​
Comments​
String​
否​
example​
服务的备注信息。​
  • 字符串形式,长度限制为 0~253 个字符。​
  • 不填默认为空。​
ServiceType​
String​
否​
AIProvider​
服务类型,取值:​
  • VeFaas:函数服务。​
  • ECS:云服务器。​
  • K8S:容器服务。​
  • Nacos:注册中心。​
  • FixedIP:固定 IP。​
  • AIProvider:AI 模型代理。​
ServiceNetworkSpec​
Object of ServiceNetworkSpec​
否​
-​
服务默认域名网络配置。​
DomainType​
String​
否​
CustomDomain​
域名类型,取值:​
  • DefaultDomain:(默认值)默认域名。​
  • CustomDomain:自定义域名。​
CustomDomains​
否​
-​
服务自定义域名网络配置。​
说明​
当DomainType取值为 CustomDomain 时,需要配置本参数。​
​
AuthSpec​
​
参数​
类型​
是否必选​
示例值​
描述​
Enable​
Boolean​
是​
true​
是否开启认证配置。取值:​
  • true:开启。​
  • false:不开启。​
​
ServiceNetworkSpec​
​
参数​
类型​
是否必选​
示例值​
描述​
EnablePublicNetwork​
Boolean​
否​
true​
是否开启公网。取值:​
  • true:开启。​
  • false:不开启。​
EnablePrivateNetwork​
Boolean​
否​
true​
是否开启私网。取值:​
  • true:开启。​
  • false:不开启。​
PrivateNetworkIP​
Array of String​
否​
["10.0.0.1"]​
私网域名解析的目标 IP。​
说明​
当ServiceNetworkSpec.EnablePrivateNetwork取值为 true 时,需要配置本参数。​
PublicNetworkIP​
Array of String​
否​
["1.1.1.1"]​
公网域名解析的目标 IP。​
说明​
当ServiceNetworkSpec.EnablePublicNetwork取值为 true 时,需要配置本参数。​
​
ServiceCustomDomain​
​
参数​
类型​
是否必选​
示例值​
描述​
Domain​
String​
是​
volcengine.com​
自定义域名。长度限制为 1~253 个字符。​
Protocol​
Array of String​
是​
["HTTP","HTTPS"]​
协议类型,取值:​
  • HTTP。​
  • HTTPS。​
CertificateId​
String​
否​
cert-c88****​
证书 ID。您可以通过 QuickApplyCertificate 创建证书。​
Comments​
String​
否​
example​
自定义域名备注信息。长度限制为 0~253 个字符。​
SSLRedirect​
Boolean​
否​
true​
是否重定向到 HTTPS。取值:​
  • true:是。​
  • false:(默认值)否。​
Tags​
Array of TagKeyValuePair​
否​
-​
自定义域名的标签。长度限制为 0~10 个。​
​
TagKeyValuePair​
​
参数​
类型​
是否必选​
示例值​
描述​
Key​
String​
是​
example-key​
自定义域名的标签键。长度限制为 1~256 个字符。​
Value​
String​
否​
example-value​
自定义域名的标签值。长度限制为 0~256 个字符。​
​
请求示例​
​
POST https://apig.cn-beijing.volcengineapi.com?Action=CreateGatewayService&Version=2021-03-03​
Content-Type: application/json​
{​
"ServiceName": "example",​
"GatewayId": "gd8****",​
"Protocol": [​
"HTTP",​
"HTTPS"​
],​
"AuthSpec": {​
"Enable": true​
},​
"Comments": "example",​
"ServiceType": "AIProvider",​
"ServiceNetworkSpec": {​
"PublicNetworkIP": [​
"1.1.1.1"​
],​
"PrivateNetworkIP": [​
"10.0.0.1"​
],​
"EnablePublicNetwork": true,​
"EnablePrivateNetwork": true​
},​
"DomainType": "CustomDomain",​
"CustomDomains": [​
{​
"Tags": [​
{​
"Key": "example-key",​
"Value": "example-value"​
}​
],​
"Domain": "volcengine.com",​
"Comments": "example",​
"Protocol": [​
"HTTP",​
"HTTPS"​
],​
"SSLRedirect": true,​
"CertificateId": "cert-c88****"​
}​
]​
}​
​
返回参数​
​
参数​
类型​
示例值​
描述​
Id​
String​
sd84****​
服务 ID。​
​
返回示例​
​
Content-Type: application/json​
{​
"ResponseMetadata": {​
"RequestId": "20230604110420****100232280022D31",​
"Action": "CreateGatewayService",​
"Version": "2021-03-03",​
"Service": "apig",​
"Region": "cn-beijing"​
},​
"Result": {​
"Id": "sd84****"​
}​
}​
​
错误码​
本接口无特有的错误码。更多信息请参见 公共错误码。​
最近更新时间:2026.07.29 10:20:02
这个页面对您有帮助吗?
有用
有用
无用
无用