新建一个 API。
接口说明
- 此接口面向开放API的用户。
- 同一个分组内API不允许重名。
- 同一个分组内Path不允许重复。
- 该接口调用的QPS限制为:单用户QPS不超过50。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
授权信息
下表是API对应的授权信息,可以在RAM权限策略语句的Action
元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:
- 操作:是指具体的权限点。
- 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
- 资源类型:是指操作中支持授权的资源类型。具体说明如下:
- 对于必选的资源类型,用背景高亮的方式表示。
- 对于不支持资源级授权的操作,用
全部资源
表示。
- 条件关键字:是指云产品自身定义的条件关键字。
- 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作 | 访问级别 | 资源类型 | 条件关键字 | 关联操作 |
---|---|---|---|---|
apigateway:CreateApi | Write |
|
| 无 |
请求参数
名称 | 类型 | 必填 | 描述 | 示例值 |
---|---|---|---|---|
GroupId | string | 是 | 指定的分组编号 | 08ae4aa0f95e4321849ee57f4e0b3077 |
ApiName | string | 是 | 设置API的名称,组内不允许重复。支持汉字,英文,数字,下划线,且只能以英文和汉字开头,4~50个字符 | ApiName |
Visibility | string | 是 | API是否公开,可以取值:
| PUBLIC |
Description | string | 否 | API描述信息,最多180个字符 | Api description |
AuthType | string | 否 | API安全认证类型,目前可以取值:
| APP |
RequestConfig | string | 是 | Consumer向网关发送API请求的相关配置项。 更多信息,请参见RequestConfig。 | {"RequestProtocol":"HTTP","RequestHttpMethod":"GET","RequestPath":"/v3/getUserTest/[userId]","BodyFormat":"FORM","PostBodyDescription":""} |
ServiceConfig | string | 是 | 网关向后端服务发送API请求的相关配置项。 更多信息,请参见ServiceConfig。 | {"ServiceProtocol":"HTTP","ServiceHttpMethod":"GET","ServiceAddress":"http://www.customerdomain.com","ServiceTimeout":"1000","ServicePath":"/v3/getUserTest/[userId]"} |
RequestParameters | string | 否 | Consumer向网关发送API请求的参数描述。 更多信息,请参见RequestParameter。 | [{"ParameterType":"Number","Required":"OPTIONAL","isHide":false,"ApiParameterName":"age","DefaultValue":"20","DemoValue":"20","Description":"年龄","MinValue":18,"MaxValue":100,"Location":"Head"},{"ParameterType":"String","Required":"OPTIONAL","isHide":false,"ApiParameterName":"sex","DefaultValue":"boy","DemoValue":"boy","Description":"性别","EnumValue":"boy,girl","Location":"Query"},{"ParameterType":"Number","Required":"REQUIRED","isHide":false,"ApiParameterName":"userId","MaxLength":10,"MinValue":10000000,"MaxValue":100000000,"Location":"Path"},{"ApiParameterName":"CaClientIp","ParameterLocation":{"name":"Head","orderNumber":0},"Location":"Head","ParameterType":"String","Required":"REQUIRED","Description":"客户端IP"},{"ApiParameterName":"constance","ParameterLocation":{"name":"Head","orderNumber":0},"Location":"Head","ParameterType":"String","Required":"REQUIRED","DefaultValue":"constance","Description":"constance"}] |
SystemParameters | string | 否 | api的公共参数,json格式 | [{\"demoValue\":\"12345678\",\"description\":\"ConsumerAppKey\",\"location\":\"HEAD\",\"parameterName\":\"CaAppKey\",\"serviceParameterName\":\"X-Ca-Key\"}] |
ConstantParameters | string | 否 | api的参数信息 | [{\"ConstantValue\":\"merchant-api.dev.internal\",\"Description\":\"后端ingress domain\",\"Location\":\"HEAD\",\"ServiceParameterName\":\"host\"}] |
ServiceParameters | string | 否 | 网关向后端服务发送API请求的参数描述。 更多信息,请参见ServiceParameter。 | [{"ServiceParameterName":"age","Location":"Head","Type":"Number","ParameterCatalog":"REQUEST"},{"ServiceParameterName":"sex","Location":"Query","Type":"String","ParameterCatalog":"REQUEST"},{"ServiceParameterName":"userId","Location":"Path","Type":"Number","ParameterCatalog":"REQUEST"},{"ServiceParameterName":"clientIp","Location":"Head","Type":"String","ParameterCatalog":"SYSTEM"},{"ServiceParameterName":"constance","Location":"Head","Type":"String","ParameterCatalog":"CONSTANT"}] |
ServiceParametersMap | string | 否 | Consumer向网关发送请求的参数和网关向后端服务发送的请求的参数的映射关系。 更多信息,请参见ServiceParameterMap。 | [{"ServiceParameterName":"age","RequestParameterName":"age"},{"ServiceParameterName":"sex","RequestParameterName":"sex"},{"ServiceParameterName":"userId","RequestParameterName":"userId"},{"ServiceParameterName":"clientIp","RequestParameterName":"CaClientIp"},{"ServiceParameterName":"constance","RequestParameterName":"constance"}] |
ResultType | string | 否 | 后端服务返回应答的格式,目前可以设置为:JSON、TEXT、BINARY、XML、HTML。默认为JSON。 | HTML |
ResultSample | string | 否 | 后端服务返回应答的示例 | 200 |
FailResultSample | string | 否 | 后端服务失败返回应答的示例 | {"errorCode":"fail","errorMessage":"param invalid"} |
ErrorCodeSamples | string | 否 | 后端服务返回的错误码示例。 更多信息,请参见ErrorCodeSample。 | [{"Code":"400","Message":"Missing the userId","Description":"参数错误"}] |
ResultDescriptions | string | 否 | api的返回说明 | [] |
OpenIdConnectConfig | string | 否 | ip访问控制的开关状态,取值:-on:打开-off:关闭 | {\"openIdApiType\":null,\"idTokenParamName\":null,\"publicKeyId\":null,\"publicKey\":null} |
AllowSignatureMethod | string | 否 | 当AuthType为APP认证时,需要传该值明确签名算法。可选值如下,不传默认是HmacSHA256:
| HmacSHA256 |
WebSocketApiType | string | 否 | 双向通信API类型:
| COMMON |
ResultBodyModel | string | 否 | api的返回结果 | {} |
ForceNonceCheck | boolean | 否 |
| true |
DisableInternet | boolean | 否 |
| true |
AppCodeAuthType | string | 否 | 当AuthType为APP认证时,可选值如下:
| HEADER |
BackendId | string | 否 | 后端服务ID | a0305308908c4740aba9cbfd63ba99b7 |
BackendEnable | boolean | 否 | 是否启用后端服务 | true |
返回参数
示例
正常返回示例
JSON
格式
{
"ApiId": "8afff6c8c4c6447abb035812e4d66b65",
"RequestId": "6C87A26A-6A18-4B8E-8099-705278381A2C"
}
错误码
访问错误中心查看更多错误码。
变更历史
变更时间 | 变更内容概要 | 操作 |
---|