阅读942 返回首页    go 英雄联盟


修改API__API管理相关接口_API_API 网关-阿里云

修改API(ModifyApi)

描述

修改API定义

  • 此接口面向开放API的用户
  • 修改ApiName时需要注意,同一个分组内API不允许重名
  • 修改RequestPath时需要注意,同一个分组内Path不允许重复
  • 该接口调用的QPS限制为:单用户QPS不超过50

请求参数

名称 类型 是否必须 描述
Action String 操作接口名,系统规定参数,取值:ModifyApi
GroupId String 指定的分组编号
ApiId String API的Id标识
ApiName String API的名称,组内不允许重复。支持汉字,英文,数字,下划线,且只能以英文和汉字开头,4~50个字符
Visibility String API是否公开,目前可以取值:
  • PUBLIC:公开,如选择此类型,该API的线上环境,会在所有用户的控制台“发现API”页面展示
  • PRIVATE:不公开,如选择此类型,当该组API在云市场上架时,私有类型的API不会上架
Description String API描述信息,最多180个字符
AuthType String API安全认证类型,目前可以取值:
  • APP:只允许已授权的APP调用
  • ANONYMOUS:允许匿名调用,设置为允许匿名调用需要注意:
    • 任何能够获取该API服务信息的人,都将能够调用该API。网关不会对调用者做身份认证,也无法设置按用户的流量控制,若开放该API请设置好按API的流量控制。
    • “ANONYMOUS”API不建议上架云市场,网关无法对调用者区分计量,也无法限制调用次数,若所在分组要上架云市场,建议将该API转移至其他分组,或将类型设置为“私有”,或选择“阿里云APP”认证方式。
  • APPOPENID:支持第三方账号认证OpenID Connect,而且只允许已授权的APP调用;当设置此项时,参数OpenIdConnectConfig为必传。
OpenIdConnectConfig String 第三方账号认证OpenID Connect相关配置项,详情见ApiAttributesType.md#OpenIdConnectConfig
RequestConfig String Consumer向网关发送API请求的相关配置项,详情见ApiAttributesType.md#RequestConfig
ServiceConfig String 网关向后端服务发送API请求的相关配置项,详情见ApiAttributesType.md#ServiceConfig
RequestParameters String Consumer向网关发送API请求的参数描述,详情见ApiAttributesType.md#RequestParameters
ServiceParameters String 网关向后端服务发送API请求的参数描述,详情见ApiAttributesType.md#ServiceParameters
ServiceParametersMap String Consumer向网关发送请求的参数和网关向后端服务发送的请求的参数的映射关系,详情见ApiAttributesType.md#ServiceParametersMap
ResultType String 后端服务返回应答的格式,目前可以设置为:JSON、TEXT、BINARY、XML、HTML
ResultSample String 后端服务返回应答的示例
FailResultSample String 后端服务失败返回应答的示例
ErrorCodeSamples String 后端服务返回的错误码示例,详情见ApiAttributesType.md#ErrorCodeSamples

返回参数

名称 类型 描述
RequestId String 本次创建API的请求Id

示例

请求示例

  1. https://ecs.aliyuncs.com/?Action=ModifyApi
  2. &GroupId=08ae4aa0f95e4321849ee57f4e0b3077
  3. &ApiName=ApiName
  4. &ApiId=8afff6c8c4c6447abb035812e4d66b65
  5. &Visibility=PUBLIC
  6. &Description=Api description
  7. &AuthType=APP
  8. &RequestConfig={"RequestProtocol":"HTTP","RequestHttpMethod":"GET","RequestPath":"/v3/getUserTest/[userId]","BodyFormat":"FORM","PostBodyDescription":""}
  9. &ServiceConfig={"ServiceProtocol":"HTTP","ServiceHttpMethod":"GET","ServiceAddress":"https://www.customerdomain.com","ServiceTimeout":"1000","ServicePath":"/v3/getUserTest/[userId]"}
  10. &RequestParameters=[{"ParameterLocation":{"name":"Head","orderNumber":1},"ParameterType":"Number","Required":"OPTIONAL","isHide":false,"ApiParameterName":"age","DefaultValue":"20","DemoValue":"20","Description":"年龄","MinValue":18,"MaxValue":100,"Location":"Head"},{"ParameterLocation":{"name":"Query","orderNumber":2},"ParameterType":"String","Required":"OPTIONAL","isHide":false,"ApiParameterName":"sex","DefaultValue":"boy","DemoValue":"boy","Description":"性别","EnumValue":"boy,girl","Location":"Query"},{"ParameterLocation":{"name":"Parameter Path","orderNumber":3},"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"}]
  11. &ServiceParameters=[{"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"}]
  12. &ServiceParametersMap=[{"ServiceParameterName":"age","RequestParameterName":"age"},{"ServiceParameterName":"sex","RequestParameterName":"sex"},{"ServiceParameterName":"userId","RequestParameterName":"userId"},{"ServiceParameterName":"clientIp","RequestParameterName":"CaClientIp"},{"ServiceParameterName":"constance","RequestParameterName":"constance"}]
  13. &ResultType=HTML
  14. &ResultSample=200
  15. &<公共请求参数>

返回示例

XML格式

  1. <ModifyApiResponse>
  2. <RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
  3. </ModifyApiResponse>

JSON格式

  1. {
  2. "RequestId":"6C87A26A-6A18-4B8E-8099-705278381A2C"
  3. }

最后更新:2016-12-15 09:04:14

  上一篇:go 删除域名证书__域名相关接口_API_API 网关-阿里云
  下一篇:go 快速切换API版本__API管理相关接口_API_API 网关-阿里云