全部产品

查询 API 定义

更新时间:2019-03-04 18:18:22

描述

查询API定义

  • 此接口面向开放API的用户
  • 用于查询指定API的定义

请求参数

名称 类型 是否必须 描述
Action String 操作接口名,系统规定参数,取值:DescribeApi
GroupId String API所在的分组编号
ApiId String API的Id标识

返回参数

名称 类型 描述
RequestId String 本次创建API的请求Id
RegionId String API所处的Region的Id
ApiId String API的Id标识
ApiName String API的名称,组内不允许重复
GroupId String API所在的分组编号
GroupName String API所在的分组名称
Visibility String API是否公开,目前可以取值:
  • PUBLIC:公开,如选择此类型,该API的线上环境,会在所有用户的控制台“发现API”页面展示
  • PRIVATE:不公开,如选择此类型,当该组API在云市场上架时,私有类型的API不会上架
AuthType String API安全认证类型,目前可以取值:
  • APP:只允许已授权的APP调用
  • ANONYMOUS:允许匿名调用,设置为允许匿名调用需要注意:
    • 任何能够获取该API服务信息的人,都将能够调用该API。网关不会对调用者做身份认证,也无法设置按用户的流量控制,若开放该API请设置好按API的流量控制。
    • “ANONYMOUS”API不建议上架云市场,网关无法对调用者区分计量,也无法限制调用次数,若所在分组要上架云市场,建议将该API转移至其他分组,或将类型设置为“私有”,或选择“阿里云APP”认证方式。
  • APPOPENID:支持第三方账号认证OpenID Connect,而且只允许已授权的APP调用;当设置此项时,参数OpenIdConnectConfig为必传。
ForceNonceCheck Boolean 调用API时是否必须携带header : X-Ca-Nonce, 这个是请求的唯一标识,一般使用UUID来标识。API网关收到这个参数后通过校验这个参数的有效性可以有效防止API的重放攻击,同样的值,15分内只能被使用一次。 取值:
  • true: 请求API时强制检查这个字段,防止API的重放攻击
  • false: 不检查这个字段
DisableInternet Boolean API是否仅支持内网调用, 取值:
  • true:仅支持内网调用API
  • false:不限制调用
ResultType String 后端服务返回应答的格式,目前可以设置为:JSON、TEXT、BINARY、XML、HTML
ResultSample String 后端服务返回应答的示例
FailResultSample String 后端服务失败返回应答的示例
CreateTime String API创建的时间
ModifyTime String API最后一次修改的时间
Description String API描述信息
ErrorCodeSamples ErrorCodeSample 后端服务返回的错误码示例。
SystemParameters SystemParameter 网关发送给后端服务的系统参数。
ConstantParameters ConstantParameter 网关发送给后端服务的常量参数。
RequestParametersObject RequestParameter Consumer向网关发送API请求的参数描述。
ServiceParametersObject ServiceParameters 网关向后端服务发送API请求的参数描述。
ParametersMapObject ServiceParametersMap Consumer向网关发送请求的参数和网关向后端服务发送的请求的参数的映射关系。
DeployedInfos DeployedInfo API发布状态。
RequestConfig RequestConfig Consumer向网关发送API请求的相关配置项。
ServiceConfig ServiceConfig 网关向后端服务发送API请求的相关配置项。
OpenIdConnectConfig OpenIdConnectConfig 第三方账号认证OpenID Connect相关配置项。
FunctionComputeConfig FunctionComputeConfig 后端为函数计算时的后端配置项

示例

请求示例

  1. https://apigateway.cn-qingdao.aliyuncs.com/?Action=DescribeApi
  2. &ApiId=8afff6c8c4c6447abb035812e4d66b65
  3. &<公共请求参数>

返回示例

XML格式

  1. <DescribeApiResponse>
  2. <RequestId>D0FF585F-7966-40CF-BC60-75DB070B23D5</RequestId>
  3. <RegionId>cn-qingdao</RegionId>
  4. <Description>Api description</Description>
  5. <ApiName>ApiName</ApiName>
  6. <CreatedTime>2016-07-28T09:50:43Z</CreatedTime>
  7. <GroupName>ApiTest</GroupName>
  8. <ModifiedTime>2016-07-28T13:13:12Z</ModifiedTime>
  9. <ServiceParametersObject>
  10. <ServiceParam>
  11. <ServiceParameterName>age</ServiceParameterName>
  12. <Type>Number</Type>
  13. <Location>head</Location>
  14. </ServiceParam>
  15. <ServiceParam>
  16. <ServiceParameterName>sex</ServiceParameterName>
  17. <Type>String</Type>
  18. <Location>query</Location>
  19. </ServiceParam>
  20. <ServiceParam>
  21. <ServiceParameterName>userId</ServiceParameterName>
  22. <Type>Number</Type>
  23. <Location>path</Location>
  24. </ServiceParam>
  25. <ServiceParam>
  26. <ServiceParameterName>clientIp</ServiceParameterName>
  27. <Type>String</Type>
  28. <Location>head</Location>
  29. </ServiceParam>
  30. <ServiceParam>
  31. <ServiceParameterName>constance</ServiceParameterName>
  32. <Type>String</Type>
  33. <Location>head</Location>
  34. </ServiceParam>
  35. </ServiceParametersObject>
  36. <ConstantParameters>
  37. <ConstantParameter>
  38. <ServiceParameterName>constance</ServiceParameterName>
  39. <Description>constance</Description>
  40. <Location>HEAD</Location>
  41. <ConstantValue>constance</ConstantValue>
  42. </ConstantParameter>
  43. </ConstantParameters>
  44. <GroupId>08ae4aa0f95e4321849ee57f4e0b3077</GroupId>
  45. <SystemParameters>
  46. <SystemParameter>
  47. <ServiceParameterName>clientIp</ServiceParameterName>
  48. <Description>客户端IP</Description>
  49. <DemoValue>192.168.1.1</DemoValue>
  50. <Location>HEAD</Location>
  51. <ParameterName>CaClientIp</ParameterName>
  52. </SystemParameter>
  53. </SystemParameters>
  54. <RequestParametersObject>
  55. <RequestParam>
  56. <Required>OPTIONAL</Required>
  57. <MinValue>18</MinValue>
  58. <Description>年龄</Description>
  59. <DemoValue>20</DemoValue>
  60. <ParameterType>NUMBER</ParameterType>
  61. <ApiParameterName>age</ApiParameterName>
  62. <DocShow>PUBLIC</DocShow>
  63. <DefaultValue>20</DefaultValue>
  64. <Location>HEAD</Location>
  65. <MaxValue>100</MaxValue>
  66. <DocOrder>0</DocOrder>
  67. </RequestParam>
  68. <RequestParam>
  69. <Required>OPTIONAL</Required>
  70. <Description>性别</Description>
  71. <DemoValue>boy</DemoValue>
  72. <ParameterType>STRING</ParameterType>
  73. <ApiParameterName>sex</ApiParameterName>
  74. <DocShow>PUBLIC</DocShow>
  75. <DefaultValue>boy</DefaultValue>
  76. <Location>QUERY</Location>
  77. <EnumValue>boy,girl</EnumValue>
  78. <DocOrder>0</DocOrder>
  79. </RequestParam>
  80. <RequestParam>
  81. <Required>REQUIRED</Required>
  82. <MinValue>10000000</MinValue>
  83. <ParameterType>NUMBER</ParameterType>
  84. <ApiParameterName>userId</ApiParameterName>
  85. <DocShow>PUBLIC</DocShow>
  86. <Location>PATH</Location>
  87. <MaxValue>100000000</MaxValue>
  88. <DocOrder>0</DocOrder>
  89. </RequestParam>
  90. </RequestParametersObject>
  91. <DeployedInfos>
  92. <DeployedInfo>
  93. <DeployedStatus>NONDEPLOYED</DeployedStatus>
  94. <StageName>TEST</StageName>
  95. </DeployedInfo>
  96. <DeployedInfo>
  97. <DeployedStatus>NONDEPLOYED</DeployedStatus>
  98. <StageName>RELEASE</StageName>
  99. </DeployedInfo>
  100. </DeployedInfos>
  101. <ServiceConfig>
  102. <ServiceProtocol>HTTP</ServiceProtocol>
  103. <ServiceTimeout>1000</ServiceTimeout>
  104. <ServiceAddress>http://www.customerdomain.com</ServiceAddress>
  105. <ServicePath>/v3/getUserTest/[userId]</ServicePath>
  106. <ServiceHttpMethod>GET</ServiceHttpMethod>
  107. <Mock>FALSE</Mock>
  108. </ServiceConfig>
  109. <RequestId>D0FF585F-7966-40CF-BC60-75DB070B23D5</RequestId>
  110. <RegionId>cn-qingdao</RegionId>
  111. <RequestConfig>
  112. <RequestHttpMethod>GET</RequestHttpMethod>
  113. <RequestProtocol>HTTP</RequestProtocol>
  114. <RequestPath>/v3/getUserTest/[userId]</RequestPath>
  115. </RequestConfig>
  116. <Visibility>PUBLIC</Visibility>
  117. <ParametersMapObject>
  118. <ServiceParameterMap>
  119. <ServiceParameterName>sex</ServiceParameterName>
  120. <RequestParameterName>sex</RequestParameterName>
  121. </ServiceParameterMap>
  122. <ServiceParameterMap>
  123. <ServiceParameterName>age</ServiceParameterName>
  124. <RequestParameterName>age</RequestParameterName>
  125. </ServiceParameterMap>
  126. <ServiceParameterMap>
  127. <ServiceParameterName>userId</ServiceParameterName>
  128. <RequestParameterName>userId</RequestParameterName>
  129. </ServiceParameterMap>
  130. </ParametersMapObject>
  131. <ErrorCodeSamples>
  132. <ErrorCodeSample>
  133. <Code>400</Code>
  134. <Message>Missing the parameter UserId</Message>
  135. <Description>请求缺少参数 UserId</Description>
  136. </ErrorCodeSample>
  137. </ErrorCodeSamples>
  138. <ApiId>8afff6c8c4c6447abb035812e4d66b65</ApiId>
  139. <AuthType>APP</AuthType>
  140. <ForceNonceCheck>true</ForceNonceCheck>
  141. <DisableInternet>true</DisableInternet>
  142. <ResultType>HTML</ResultType>
  143. <ResultSample>200</ResultSample>
  144. <FailResultSample>400</FailResultSample>
  145. <OpenIdConnectConfig>
  146. <publicKey>EB1837F8693CCED0BF750B3AD48467BEB569E780A14591CF92</publicKey>
  147. <openIdApiType>IDTOKEN</openIdApiType>
  148. <publicKeyId>88483727556929326703309904351185815489</publicKeyId>
  149. </OpenIdConnectConfig>
  150. </DescribeApiResponse>

JSON格式

  1. {
  2. "RequestId":D0FF585F-7966-40CF-BC60-75DB070B23D5,
  3. "RegionId":cn-qingdao,
  4. "Description": "billingTest001",
  5. "ApiName": "billingTest001",
  6. "CreatedTime": "2016-07-01T09:18:20Z",
  7. "GroupName": "billingTest",
  8. "ModifiedTime": "2016-07-21T03:52:12Z",
  9. "ServiceParametersObject": {
  10. "ServiceParam": [
  11. {
  12. "ServiceParameterName": "headerParam",
  13. "Type": "String",
  14. "Location": "head"
  15. },
  16. {
  17. "ServiceParameterName": "queryparam",
  18. "Type": "String",
  19. "Location": "query"
  20. },
  21. {
  22. "ServiceParameterName": "NumberParam",
  23. "Type": "Number",
  24. "Location": "query"
  25. },
  26. {
  27. "ServiceParameterName": "type",
  28. "Type": "String",
  29. "Location": "path"
  30. },
  31. {
  32. "ServiceParameterName": "clientIp",
  33. "Type": "String",
  34. "Location": "head"
  35. },
  36. {
  37. "ServiceParameterName": "constantParam",
  38. "Type": "String",
  39. "Location": "query"
  40. }
  41. ]
  42. },
  43. "ConstantParameters": {
  44. "ConstantParameter": [
  45. {
  46. "ServiceParameterName": "constantParam",
  47. "Description": "constant",
  48. "Location": "QUERY",
  49. "ConstantValue": "constant"
  50. }
  51. ]
  52. },
  53. "GroupId": "4a3f3050b9c5469bb685bdd29e571be1",
  54. "SystemParameters": {
  55. "SystemParameter": [
  56. {
  57. "ServiceParameterName": "clientIp",
  58. "Description": "客户端IP",
  59. "DemoValue": "192.168.1.1",
  60. "Location": "HEAD",
  61. "ParameterName": "CaClientIp"
  62. }
  63. ]
  64. },
  65. "RequestParametersObject": {
  66. "RequestParam": [
  67. {
  68. "Required": "OPTIONAL",
  69. "Description": "head param",
  70. "DemoValue": "headparm",
  71. "ParameterType": "STRING",
  72. "ApiParameterName": "headerParam",
  73. "DocShow": "PUBLIC",
  74. "DefaultValue": "",
  75. "Location": "HEAD",
  76. "EnumValue": "head",
  77. "DocOrder": 0
  78. },
  79. {
  80. "Required": "REQUIRED",
  81. "ParameterType": "STRING",
  82. "ApiParameterName": "queryparam",
  83. "DocShow": "PUBLIC",
  84. "DefaultValue": "",
  85. "Location": "QUERY",
  86. "DocOrder": 0
  87. },
  88. {
  89. "Required": "OPTIONAL",
  90. "MinValue": 1,
  91. "Description": "number param",
  92. "DemoValue": "10",
  93. "ParameterType": "NUMBER",
  94. "ApiParameterName": "NumberParam",
  95. "DocShow": "PUBLIC",
  96. "DefaultValue": "10",
  97. "Location": "QUERY",
  98. "MaxValue": 100,
  99. "DocOrder": 0
  100. },
  101. {
  102. "Required": "REQUIRED",
  103. "ParameterType": "STRING",
  104. "ApiParameterName": "type",
  105. "DocShow": "PUBLIC",
  106. "Location": "PATH",
  107. "DocOrder": 0
  108. }
  109. ]
  110. },
  111. "DeployedInfos": {
  112. "DeployedInfo": [
  113. {
  114. "DeployedStatus": "NONDEPLOYED",
  115. "StageName": "TEST"
  116. },
  117. {
  118. "DeployedStatus": "DEPLOYED",
  119. "StageName": "RELEASE",
  120. "EffectiveVersion": "20160721115223375"
  121. }
  122. ]
  123. },
  124. "ServiceConfig": {
  125. "ServiceProtocol": "HTTP",
  126. "ServiceTimeout": 10000,
  127. "ServiceAddress": "http://120.55.69.157:8080",
  128. "ServicePath": "/web/cloudapi/[type]",
  129. "ServiceHttpMethod": "POST",
  130. "Mock": "CLOSED"
  131. },
  132. "RequestId": "415F037A-94C2-4100-B17A-F3C514CA1391",
  133. "RegionId": "cn-qingdao",
  134. "RequestConfig": {
  135. "RequestHttpMethod": "POST",
  136. "RequestProtocol": "HTTP",
  137. "PostBodyDescription": "fwefwef",
  138. "BodyFormat": "STREAM",
  139. "RequestPath": "/api/billing/test/[type]"
  140. },
  141. "Visibility": "PUBLIC",
  142. "ParametersMapObject": {
  143. "ServiceParameterMap": [
  144. {
  145. "ServiceParameterName": "headerParam",
  146. "RequestParameterName": "headerParam"
  147. },
  148. {
  149. "ServiceParameterName": "queryparam",
  150. "RequestParameterName": "queryparam"
  151. },
  152. {
  153. "ServiceParameterName": "NumberParam",
  154. "RequestParameterName": "NumberParam"
  155. },
  156. {
  157. "ServiceParameterName": "type",
  158. "RequestParameterName": "type"
  159. }
  160. ]
  161. },
  162. "ErrorCodeSamples": {
  163. "ErrorCodeSample": [
  164. {
  165. "Code": "400",
  166. "Message": "Missing the parameter UserId",
  167. "Description": "请求缺少参数 UserId"
  168. }
  169. ]
  170. },
  171. "ApiId": "e77fd9257b1d436a806fe23c649300a0",
  172. "AuthType": "APP",
  173. "ForceNonceCheck" true,
  174. "DisableInternet" true,
  175. "ResultType": "JSON",
  176. "ResultSample": "fwef",
  177. "FailResultSample": "400",
  178. "OpenIdConnectConfig": {
  179. "publicKey": "EB1837F8693CCED0BF750B3AD48467BEB569E780A14591CF92",
  180. "openIdApiType": "IDTOKEN",
  181. "publicKeyId": "88483727556929326703309904351185815489"
  182. }
  183. }