云服务器内容精选

  • 响应示例 状态码: 200 OK { "total" : 2, "size" : 2, "apis" : [ { "run_env_name" : "RELEASE", "group_name" : "api_group_001", "publish_id" : "9f27d1dc4f4242a9abf88e563dbfc33d", "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "name" : "Api_mock", "remark" : "Mock backend API", "run_env_id" : "DEFAULT_ENVIRONMENT_RELEASE_ID", "id" : "3a955b791bd24b1c9cd94c745f8d1aad", "type" : 1, "auth_type" : " IAM ", "req_uri" : "/test/mock" }, { "run_env_name" : "RELEASE", "group_name" : "APIGroup_d00511069", "publish_id" : "0c613568c8644a1b92172156f77a5759", "group_id" : "d7d0b9a54469424f942e16a6b6026936", "name" : "API_nevj", "run_env_id" : "DEFAULT_ENVIRONMENT_RELEASE_ID", "id" : "9e07bc00a1864ab4aafd4a23d19dd1c2", "type" : 1, "auth_type" : "APP", "req_uri" : "/fdasf" } ]} 状态码: 400 Bad Request { "error_code" : "APIG.2012", "error_msg" : "Invalid parameter value,parameterName:throttle_id. Please refer to the support documentation"} 状态码: 401 Unauthorized { "error_code" : "APIG.1002", "error_msg" : "Incorrect token or token resolution failed"} 状态码: 403 Forbidden { "error_code" : "APIG.1005", "error_msg" : "No permissions to request this method"} 状态码: 404 Not Found { "error_code" : "APIG.3005", "error_msg" : "Request throttling policy 3437448ad06f4e0c91a224183116e965 does not exist"} 状态码: 500 Internal Server Error { "error_code" : "APIG.9999", "error_msg" : "System error"}
  • URI GET /v2/{project_id}/apigw/instances/{instance_id}/throttle-bindings/unbinded-apis 表1 路径参数 参数 是否必选 参数类型 描述 project_id 是 String 项目ID,获取方式请参见获取项目ID。 instance_id 是 String 实例ID,在API网关控制台的“实例信息”中获取。 表2 Query参数 参数 是否必选 参数类型 描述 offset 否 Long 偏移量,表示从此偏移量开始查询,偏移量小于0时,自动转换为0 缺省值:0 limit 否 Integer 每页显示的条目数量,条目数量小于等于0时,自动转换为20,条目数量大于500时,自动转换为500 最小值:1 最大值:500 缺省值:20 throttle_id 是 String 流控策略编号 env_id 否 String 环境的ID group_id 否 String API分组编号 api_id 否 String API编号 api_name 否 String API名称 tags 否 String API标签,该参数可指定多个,多个不同的参数值为或关系;不指定或为空时,表示不筛选标签;指定为#no_tags#时,表示筛选无标签API。 最小长度:0 最大长度:128
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 size Integer 本次返回的列表长度 total Long 满足条件的记录数 apis Array of ApiForThrottle objects 本次查询返回的API列表 表5 ApiForThrottle 参数 参数类型 描述 auth_type String API的认证方式 group_name String API所属分组的名称 publish_id String API的发布记录编号 throttle_apply_id String 与流控策略的绑定关系编号 apply_time String 已绑定的流控策略的绑定时间 remark String API描述 run_env_id String 发布的环境id type Integer API类型 throttle_name String 绑定的流控策略名称 req_uri String API的访问地址 run_env_name String 发布的环境名 group_id String API所属分组的编号 name String API名称 id String API编号 req_method String API请求方法 tags Array of strings API绑定的标签,标签配额默认10条,可以联系技术调整。 最小长度:1 最大长度:128 数组长度:0 - 10 状态码: 400 表6 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 401 表7 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 403 表8 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 404 表9 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 500 表10 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述
  • 功能介绍 将流控策略应用于API,则所有对该API的访问将会受到该流控策略的限制。当一定时间内的访问次数超过流控策略设置的API最大访问次数限制后,后续的访问将会被拒绝,从而能够较好的保护后端API免受异常流量的冲击,保障服务的稳定运行。 为指定的API绑定流控策略,绑定时,需要指定在哪个环境上生效。 同一个API发布到不同的环境可以绑定不同的流控策略;一个API在发布到特定环境后只能绑定一个默认的流控策略。
  • 响应消息 表4 参数说明 名称 类型 说明 throttle_applys 字典数据类型 API与流控策略的绑定关系列表 表5 throttle_applys参数说明 名称 类型 说明 id String 绑定关系的ID。 strategy_id String 流控策略的ID。 publish_id String API的发布记录编号 scope Integer 策略作用域,取值如下: 1: 整个API 2: 单个用户 3: 单个APP 目前只支持1 apply_time Timestamp 绑定时间 响应消息样例: {"throttle_applys": [{"id": "507c6a9f-8322-4dc2-8ba5-b4d74e3690d3","strategy_id": "0325b671-2d50-4614-9868-22102262695d","publish_id": "374a6d5a-20c7-4ea1-82e1-19fce4556956","scope": 1,"apply_time": "2017-12-29T03:01:11.138456Z"},{"id": "90f05978-06a3-4096-8bea-b5e2fa12b843","strategy_id": "0325b671-2d50-4614-9868-22102262695d","publish_id": "65e6fe53-1ac3-4481-ba36-9f0bc6f22057","scope": 1,"apply_time": "2017-12-29T03:01:11.138456Z"}]}
  • URI HTTP/HTTPS请求方法以及URI如下表所示。 表1 HTTP/HTTPS请求方法及URI 请求方法 URI POST /v1/{project_id}/apigw/instances/{instance_id}/throttle-bindings URI中的参数说明如下表所示。 表2 参数说明 名称 是否必选 类型 说明 project_id 是 String 项目ID。可从控制台“我的凭证”中获取region下项目ID,管理员权限可查询。 instance_id 是 String 实例ID,可从API网关控制台的专享版实例信息中获取。
  • 请求消息 表3 参数说明 名称 是否必选 类型 说明 publish_ids 是 Array of strings API的发布记录编号 strategy_id 是 String 流控策略编号 请求参数样例: { "publish_ids": [ "374a6d5a-20c7-4ea1-82e1-19fce4556956", "65e6fe53-1ac3-4481-ba36-9f0bc6f22057" ], "strategy_id": "0325b671-2d50-4614-9868-22102262695d"}
  • 响应参数 状态码: 400 表3 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 401 表4 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 403 表5 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 404 表6 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 500 表7 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述
  • 响应示例 状态码: 400 Bad Request { "error_code" : "APIG.2012", "error_msg" : "Invalid parameter value,parameterName:id. Please refer to the support documentation"} 状态码: 401 Unauthorized { "error_code" : "APIG.1002", "error_msg" : "Incorrect token or token resolution failed"} 状态码: 403 Forbidden { "error_code" : "APIG.1005", "error_msg" : "No permissions to request this method"} 状态码: 404 Not Found { "error_code" : "APIG.3012", "error_msg" : "The request throttling policy binding record does not exist"} 状态码: 500 Internal Server Error { "error_code" : "APIG.9999", "error_msg" : "System error"}