云服务器内容精选

  • 支持http to https自动重定向 2022年11月30日之后的版本支持HTTP重定向到HTTPS。 约束限制 由于浏览器限制,非GET或非HEAD方法的重定向可能导致数据丢失,因此API请求方法限定为GET或HEAD。 开启重定向需满足以下条件: 创建API时,前端配置的请求协议选择“HTTPS”或“HTTP&HTTPS”。 API所属API分组已绑定独立域名和SSL证书,具体操作请参见上文。 独立域名绑定完成后,在“支持http to https自动重定向”列开启重定向功能。
  • 什么是跨域访问 浏览器出于安全性考虑,会限制从页面脚本内发起的跨域访问(CORS)请求,此时页面只能访问同源的资源,而CORS允许浏览器向跨域服务器,发送XMLHttpRequest请求,从而实现跨域访问。 图1 跨域访问示意图 浏览器将CORS请求分为两类: 简单请求 简单跨域请求的场景需要满足以下两个条件: 请求方法是HEAD,GET,或者POST。 HTTP的头信息不超出以下范围: Accept Accept-Language Content-Language Last-Event-ID Content-Type:取值范围:application/x-www-form-urlencoded、multipart/form-data、text/plain 对于简单请求,浏览器自动在头信息之中,添加一个Origin字段,Origin字段用于说明本次请求来自哪个源(协议+域名+端口)。服务器根据这个值,决定是否同意这次请求。服务器响应消息中包含“Access-Control-Allow-Origin”时,表示同意请求。 非简单请求 不满足简单请求两个条件的都为非简单请求。 对于非简单请求,在正式通信之前,浏览器会增加一次HTTP查询请求,称为预检请求。浏览器询问服务器,当前页面所在的源是否在服务器的许可名单之中,以及可以使用哪些HTTP请求方法和头信息字段。预检通过后,浏览器向服务器发送简单请求。
  • 开启跨域访问 API网关默认不开启跨域访问,如果您需要开启,请参考以下说明完成跨域配置。 简单请求的跨域访问 如果是创建新的API,在定义API请求时,打开“支持跨域(CORS)”开关。详细的使用指导,可参考简单请求。 图2 支持跨域 非简单请求的跨域访问 非简单请求的跨域访问需要在API的分组中创建一个“Method”为“OPTIONS”的API,作为预检请求。 预检请求API的参数设置,请参考以下说明填写。详细的使用指导可参考非简单请求。 在API的基本信息中,安全认证选“无认证”。 图3 预检请求-使用无认证 定义API请求时,参数填写说明如下: 请求协议:选择与已开启CORS的API相同的请求协议 请求Path:填斜杠/ Method:选择“OPTIONS” 支持CORS:选择开启CORS 图4 预检请求-设置API请求 后端服务选择Mock。 图5 预检请求-后端服务类型Mock
  • 简单请求 对于简单请求,您需要开启简单跨域访问。 场景一:已开启CORS,且后端服务响应消息中未指定跨域头时,API网关接受任意域的请求,并返回“Access-Control-Allow-Origin”跨域头,示例如下: 浏览器发送一个带Origin字段的请求消息: GET /simple HTTP/1.1 Host: www.test.com Origin: http://www.cors.com Content-Type: application/x-www-form-urlencoded; charset=utf-8 Accept: application/json Date: Tue, 15 Jan 2019 01:25:52 GMT Origin:此字段必选,表示请求消息所属源,上例中请求来源于“http://www.cors.com”,API网关/后端服务根据这个值,决定是否同意本次请求。 后端服务返回响应消息: HTTP/1.1 200 OK Date: Tue, 15 Jan 2019 01:25:52 GMT Content-Type: application/json Content-Length: 16 Server: api-gateway {"status":"200"} API网关响应消息: HTTP/1.1 200 OK Date: Tue, 15 Jan 2019 01:25:52 GMT Content-Type: application/json Content-Length: 16 Server: api-gateway X-Request-Id: 454d689fa69847610b3ca486458fb08b Access-Control-Allow-Origin: * {"status":"200"} Access-Control-Allow-Origin:此字段必选,“*”表示API网关接受任意域的请求。 场景二:已开启CORS,且后端服务响应消息中指定跨域头时,后端服务响应的跨域头将覆盖API网关增加的跨域头,示例如下: 浏览器发送一个带Origin字段的请求消息: GET /simple HTTP/1.1 Host: www.test.com Origin: http://www.cors.com Content-Type: application/x-www-form-urlencoded; charset=utf-8 Accept: application/json Date: Tue, 15 Jan 2019 01:25:52 GMT Origin:此字段必选,表示请求消息所属源,上例中请求来源于“http://www.cors.com”,API网关/后端服务根据这个值,决定是否同意本次请求。 后端服务返回响应消息: HTTP/1.1 200 OK Date: Tue, 15 Jan 2019 01:25:52 GMT Content-Type: application/json Content-Length: 16 Server: api-gateway Access-Control-Allow-Origin: http://www.cors.com {"status":"200"} Access-Control-Allow-Origin:表示后端服务接受“http://www.cors.com”的请求。 API网关响应消息: HTTP/1.1 200 OK Date: Tue, 15 Jan 2019 01:25:52 GMT Content-Type: application/json Content-Length: 16 Server: api-gateway X-Request-Id: 454d689fa69847610b3ca486458fb08b Access-Control-Allow-Origin: http://www.cors.com {"status":"200"} 后端服务响应消息中的跨域头覆盖API网关响应消息中的跨域头。
  • 非简单请求 对于非简单请求,您需要开启跨域访问,并且创建一个“Method”为“OPTIONS”的API。 跨域共享资源插件不需要创建一个“Method”为“OPTIONS”的API。 “Method”为“OPTIONS”的API和普通API的区别如下: 所属分组:选择已开启CORS的API所在的分组。 安全认证:可选择“无认证”。无论选择哪种认证方式,API网关都按照无认证处理。 请求协议:选择与已开启CORS的API相同的请求协议。 请求Path:填斜杠/即可,也可选择与已开启CORS的API相同或者匹配的请求Path。 Method:选择“OPTIONS”。 支持CORS:选择开启CORS。 假设后端服务类型为Mock,示例如下: 浏览器发送“Method”为“OPTIONS”的API请求: OPTIONS /HTTP/1.1 User-Agent: curl/7.29.0 Host: localhost Accept: */* Origin: http://www.cors.com Access-Control-Request-Method: PUT Access-Control-Request-Headers: X-Sdk-Date Origin:此字段必选,表示请求消息所属源。 Access-Control-Request-Method:此字段必选,表示请求会使用哪些HTTP请求方法。 Access-Control-Request-Headers:此字段可选,表示请求会额外发送的头信息字段。 后端服务返回消息:无 API网关返回消息: HTTP/1.1 200 OK Date: Tue, 15 Jan 2019 02:38:48 GMT Content-Type: application/json Content-Length: 1036 Server: api-gateway X-Request-Id: c9b8926888c356d6a9581c5c10bb4d11 Access-Control-Allow-Origin: * Access-Control-Allow-Headers: X-Stage,X-Sdk-Date,X-Sdk-Nonce,X-Proxy-Signed-Headers,X-Sdk-Content-Sha256,X-Forwarded-For,Authorization,Content-Type,Accept,Accept-Ranges,Cache-Control,Range Access-Control-Expose-Headers: X-Request-Id,X-Apig-Latency,X-Apig-Upstream-Latency,X-Apig-RateLimit-Api,X-Apig-RateLimit-User,X-Apig-RateLimit-App,X-Apig-RateLimit-Ip,X-Apig-RateLimit-Api-Allenv Access-Control-Allow-Methods: GET,POST,PUT,DELETE,HEAD,OPTIONS,PATCH Access-Control-Max-Age: 172800 Access-Control-Allow-Origin:此字段必选,“*”表示API网关接受任意域的请求。 Access-Control-Allow-Headers:当请求消息中包含此字段时,此字段必选。表示允许跨域的所有请求头信息字段。 Access-Control-Expose-Headers:表示跨域访问允许查看的返回头信息字段。 Access-Control-Allow-Methods:此字段必选,表示API网关支持的所有HTTP请求方法。 Access-Control-Max-Age:此字段可选,表示本次预检的有效期,单位:秒。在有效期内,无需再次发出预检请求。 浏览器发送一个带Origin字段的请求头: PUT /simple HTTP/1.1 Host: www.test.com Origin: http://www.cors.com Content-Type: application/x-www-form-urlencoded; charset=utf-8 Accept: application/json Date: Tue, 15 Jan 2019 01:25:52 GMT 后端服务返回消息: HTTP/1.1 200 OK Date: Tue, 15 Jan 2019 01:25:52 GMT Content-Type: application/json Content-Length: 16 Server: api-gateway {"status":"200"} API网关返回消息: HTTP/1.1 200 OK Date: Tue, 15 Jan 2019 01:25:52 GMT Content-Type: application/json Content-Length: 16 Server: api-gateway X-Request-Id: 454d689fa69847610b3ca486458fb08b Access-Control-Allow-Origin: * {"status":"200"}
  • 响应示例 状态码: 201 Created 示例 1 { "id" : "5f918d104dc84480a75166ba99efff21", "tags" : [ "webApi" ], "arrange_necessary" : 2, "backend_type" : "HTTP", "auth_type" : "AUTHORIZER", "auth_opt" : { "app_code_auth_type" : "DISABLE" }, "authorizer_id" : "0d982c1ac3da493dae47627b6439fc5c", "backend_api" : { "update_time" : "2020-07-31T12:42:51.325312994Z", "vpc_channel_status" : 2, "url_domain" : "xxx.xxx.xxx.xxx:12346", "req_protocol" : "HTTP", "id" : "1ce8fda3586d4371bd83c955df37e102", "req_method" : "GET", "register_time" : "2020-07-31T12:42:51.325312721Z", "req_uri" : "/benchmark", "timeout" : 5000, "status" : 1, "retry_count" : "-1" }, "cors" : false, "status" : 1, "group_name" : "api_group_001", "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "group_version" : "V1", "response_id" : "981e6c8f847f47199a9faf4409b751a5", "match_mode" : "NORMAL", "name" : "Api_http", "req_protocol" : "HTTPS", "req_method" : "GET", "req_uri" : "/test/http", "type" : 1, "result_normal_sample" : "Example success response", "result_failure_sample" : "Example failure response", "version" : "V0.0.1", "register_time" : "2020-07-31T12:42:51.314357035Z", "update_time" : "2020-07-31T12:42:51.314357324Z", "remark" : "Web backend API", "req_params" : [ { "name" : "query_demo", "location" : "QUERY", "type" : "STRING", "valid_enable" : 2, "required" : 1, "id" : "57c8bf3c97ef40ee94eace95dff30014", "pass_through" : 1 }, { "name" : "header-demo", "location" : "HEADER", "type" : "STRING", "valid_enable" : 2, "required" : 2, "id" : "8d993be96980415faa6b1fb2ebd647e0", "pass_through" : 1 } ], "backend_params" : [ { "name" : "backHeader", "value" : "header-demo", "location" : "HEADER", "origin" : "REQUEST", "id" : "709f0ea376b44aaf907aaaa37d8cce92", "req_param_id" : "8d993be96980415faa6b1fb2ebd647e0" }, { "name" : "backQuery", "value" : "query_demo", "location" : "QUERY", "origin" : "REQUEST", "id" : "2f152d0fb54445039158d29c2a4f69ee", "req_param_id" : "57c8bf3c97ef40ee94eace95dff30014" }, { "name" : "X-CONSTANT-HEADER", "value" : "demo", "location" : "HEADER", "origin" : "CONSTANT", "remark" : "constant_demo", "id" : "20142102c6aa4f3c97d5fd6ef4010ac2" }, { "name" : "app-id", "value" : "$context.appId", "location" : "HEADER", "origin" : "SYSTEM", "remark" : "App ID of the API caller", "id" : "a1349c61016e4d999ca783a50bfeee2b" } ] } 示例 2 { "id" : "8789c9367rd1439rf869c23cc0d1ef22", "tags" : [ "grpcApi" ], "arrange_necessary" : 2, "backend_type" : "GRPC", "auth_type" : "APP", "auth_opt" : { "app_code_auth_type" : "DISABLE" }, "backend_api" : { "update_time" : "2023-08-29T09:05:17.652404554Z", "vpc_channel_status" : 1, "vpc_channel_info" : { "cascade_flag" : false, "vpc_channel_id" : "abcd1234512345678aab9a2614a197ef4", "vpc_channel_port" : 0 }, "url_domain" : "abcd1234512345678aab9a2614a197ef4", "req_protocol" : "GRPCS", "id" : "c0123456789d421cb83a396955bd48d0", "req_method" : "POST", "register_time" : "2023-08-29T09:05:17.652404454Z", "req_uri" : "/", "timeout" : 5000, "enable_client_ssl" : false, "retry_count" : "-1", "status" : 1 }, "cors" : false, "status" : 1, "group_name" : "api_group_001", "group_id" : "12345abc9215b40bd84f4c469d56daebe", "group_version" : "V1", "response_id" : "ef21ec8c7df94d72a44f9rf1461c5f62", "match_mode" : "NORMAL", "name" : "Api_grpc", "req_protocol" : "GRPCS", "req_method" : "POST", "req_uri" : "/test/grpc", "type" : 1, "version" : "V0.0.1", "register_time" : "2023-08-29T09:05:17.647533939Z", "update_time" : "2023-08-29T09:05:17.647534036Z", "remark" : "GRPC backend API", "api_group_info" : { "id" : "12345abc9215b40bd84f4c469d56daebe", "name" : "api_group_001", "status" : 1, "sl_domain" : "12345abc9215b40bd84f4c469d56daebe.apic.region-1.example.com", "register_time" : "2023-08-29T08:38:21Z", "update_time" : "2023-08-29T08:38:21Z", "on_sell_status" : 2, "sl_domain_access_enabled" : true } } 示例 3 { "id" : "abd9c4b2ff974888b0ba79be7e6b2763", "arrange_necessary" : 2, "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "group_name" : "api_group_001", "group_version" : "V1", "match_mode" : "NORMAL", "name" : "Api_function", "auth_type" : "APP", "auth_opt" : { "auth_code_auth_type" : "DISABLE" }, "backend_type" : "FUNCTION", "func_info" : { "id" : "c0740524cd4c40e3801a7afe5375f8b0", "authorizer_id" : "5b8cd3f06f004115aec69c58f57272c9", "function_urn" : "'urn:fss:xx-xxx-7:73d69ae0cfcf460190522d06b60f05ad:function:default:auto_testfunc93749'", "invocation_type" : "sync", "network_type" : "V1", "timeout" : 5000, "version" : "latest", "alias_urn" : "urn:fss:region01:73d69ae0cfcf460190522d06b60f05ad:function:default:auto_testfunc00000:!a1", "register_time" : "2020-08-02T15:36:19.897262803Z", "update_time" : "2020-08-02T15:36:19.897262993Z", "status" : 1 }, "cors" : false, "req_protocol" : "HTTPS", "req_uri" : "/test/function", "remark" : "FunctionGraph backend API", "type" : 1, "version" : "V0.0.1", "status" : 1, "req_method" : "GET", "result_normal_sample" : "Example success response", "result_failure_sample" : "Example failure response", "tags" : [ "functionApi" ], "register_time" : "2020-08-02T15:36:19.892012381Z", "update_time" : "2020-08-02T15:36:19.892012627Z" } 示例 4 { "id" : "3a955b791bd24b1c9cd94c745f8d1aad", "arrange_necessary" : 2, "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "group_name" : "api_group_001", "group_version" : "V1", "match_mode" : "SWA", "name" : "Api_mock", "auth_type" : "IAM", "auth_opt" : { "auth_code_auth_type" : "DISABLE" }, "backend_type" : "MOCK", "mock_info" : { "id" : "e74bbc75825c4c38ae84ccab6bdc6175", "result_content" : "mock success", "update_time" : "2020-08-02T15:56:52.301790686Z", "register_time" : "2020-08-02T15:56:52.301790367Z" }, "policy_mocks" : [ { "name" : "Mock policy backend", "id" : "1cb05173a4c84b7d996e30145cce3c7d", "effect_mode" : "ANY", "result_content" : "mock policy success", "conditions" : [ { "condition_origin" : "source", "condition_value" : "1.0.1.0", "id" : "8650b3a94e7344df8251658d8aee1f6d" } ] } ], "cors" : false, "req_protocol" : "HTTPS", "req_uri" : "/test/mock", "remark" : "Mock backend API", "type" : 1, "version" : "V0.0.1", "req_method" : "GET", "result_normal_sample" : "Example success response", "result_failure_sample" : "Example failure response", "tags" : [ "mockApi" ], "register_time" : "2020-08-02T15:56:52.286099413Z", "update_time" : "2020-08-02T15:56:52.286099715Z", "status" : 1 } 状态码: 400 Bad Request { "error_code" : "APIG.2011", "error_msg" : "Invalid parameter value,parameterName:name. 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.3019", "error_msg" : "The function URN does not exist" } 状态码: 500 Internal Server Error { "error_code" : "APIG.9999", "error_msg" : "System error" }
  • 请求示例 创建Web后端API { "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "match_mode" : "NORMAL", "name" : "Api_http", "auth_type" : "AUTHORIZER", "authorizer_id" : "0d982c1ac3da493dae47627b6439fc5c", "backend_type" : "HTTP", "backend_api" : { "url_domain" : "192.168.189.156:12346", "req_protocol" : "HTTP", "req_method" : "GET", "req_uri" : "/test/benchmark", "timeout" : 5000, "retry_count" : "-1" }, "req_protocol" : "HTTPS", "req_uri" : "/test/http", "remark" : "Web backend API", "type" : 1, "req_method" : "GET", "result_normal_sample" : "Example success response", "result_failure_sample" : "Example failure response", "tags" : [ "webApi" ], "req_params" : [ { "name" : "query_demo", "location" : "QUERY", "type" : "STRING", "required" : 1 }, { "name" : "header-demo", "location" : "HEADER", "type" : "STRING", "required" : 2 } ], "backend_params" : [ { "name" : "backHeader", "value" : "header-demo", "location" : "HEADER", "origin" : "REQUEST" }, { "name" : "backQuery", "value" : "query_demo", "location" : "QUERY", "origin" : "REQUEST" }, { "name" : "X-CONSTANT-HEADER", "value" : "demo", "location" : "HEADER", "origin" : "CONSTANT", "remark" : "constant_demo" }, { "name" : "app-id", "value" : "$context.appId", "location" : "HEADER", "origin" : "SYSTEM", "remark" : "App ID of the API caller" } ] } 创建GRPC后端API { "group_id" : "12345abc9215b40bd84f4c469d56daebe", "match_mode" : "NORMAL", "name" : "Api_grpc", "auth_type" : "APP", "backend_type" : "GRPC", "backend_api" : { "req_protocol" : "GRPCS", "req_method" : "POST", "req_uri" : "/", "timeout" : 5000, "retry_count" : "-1", "enable_client_ssl" : false, "vpc_channel_status" : 1, "vpc_channel_info" : { "vpc_channel_id" : "abcd1234512345678aab9a2614a197ef4" } }, "req_protocol" : "GRPCS", "req_uri" : "/test/grpc", "remark" : "GRPC backend API", "type" : 1, "req_method" : "POST", "tags" : [ "grpcApi" ], "cors" : false, "auth_opt" : { "app_code_auth_type" : "DISABLE" } } 创建函数工作流后端API { "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "match_mode" : "NORMAL", "name" : "Api_function", "auth_type" : "APP", "backend_type" : "FUNCTION", "func_info" : { "authorizer_id" : "5b8cd3f06f004115aec69c58f57272c9", "function_urn" : "'urn:fss:xx-xxx-7:73d69ae0cfcf460190522d06b60f05ad:function:default:auto_testfunc93749'", "invocation_type" : "sync", "network_type" : "V1", "timeout" : 5000, "version" : "latest", "alias_urn" : "urn:fss:region01:73d69ae0cfcf460190522d06b60f05ad:function:default:auto_testfunc93749:!a1" }, "req_protocol" : "HTTPS", "req_uri" : "/test/function", "remark" : "FunctionGraph backend API", "type" : 1, "req_method" : "GET", "result_normal_sample" : "Example success response", "result_failure_sample" : "Example failure response", "tags" : [ "functionApi" ] } 创建模拟后端API { "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "match_mode" : "SWA", "name" : "Api_mock", "auth_type" : "IAM", "backend_type" : "MOCK", "mock_info" : { "result_content" : "mock success" }, "policy_mocks" : [ { "name" : "Mock policy backend", "effect_mode" : "ANY", "result_content" : "mock policy success", "conditions" : [ { "condition_origin" : "source", "condition_value" : "1.0.1.0" } ] } ], "req_protocol" : "HTTPS", "req_uri" : "/test/mock", "remark" : "Mock backend API", "type" : 1, "req_method" : "GET", "result_normal_sample" : "Example success response", "result_failure_sample" : "Example failure response", "tags" : [ "mockApi" ] }
  • 响应参数 状态码: 201 表15 响应Body参数 参数 参数类型 描述 name String API名称。 支持汉字、英文、数字、中划线、下划线、点、斜杠、中英文格式下的小括号和冒号、中文格式下的顿号,且只能以英文、汉字和数字开头,3-255个字符。 说明: 中文字符必须为UTF-8或者unicode编码。 type Integer API类型 1:公有API 2:私有API 枚举值: 1 2 version String API的版本 最大长度:16 req_protocol String API的请求协议 HTTP HTTPS BOTH:同时支持HTTP和HTTPS GRPCS 缺省值:HTTPS 枚举值: HTTP HTTPS BOTH GRPCS req_method String API的请求方式,当API的请求协议为GRPC类型协议时请求方式固定为POST。 枚举值: GET POST PUT DELETE HEAD PATCH OPTIONS ANY req_uri String 请求地址。可以包含请求参数,用{}标识,比如/getUserInfo/{userId},支持 * / %- _ . 等特殊字符,总长度不超过512,且满足URI规范。 说明: 需要服从URI规范。 auth_type String API的认证方式 NONE:无认证 APP:APP认证 IAM:IAM认证 AUTHORIZER:自定义认证,当auth_type取值为AUTHORIZER时,authorizer_id字段必须传入 当API的请求协议为GRPC类型时不支持自定义认证。 枚举值: NONE APP IAM AUTHORIZER auth_opt AuthOpt object 认证方式参数 cors Boolean 是否支持跨域 TRUE:支持 FALSE:不支持 缺省值:false 枚举值: true false match_mode String API的匹配方式 SWA:前缀匹配 NORMAL:正常匹配(绝对匹配) 默认:NORMAL 枚举值: SWA NORMAL backend_type String 后端类型 HTTP:web后端 FUNCTION:函数工作流,当backend_type取值为FUNCTION时,func_info字段必须传入 MOCK:模拟的后端,当backend_type取值为MOCK时,mock_info字段必须传入 GRPC:grpc后端 枚举值: HTTP FUNCTION MOCK GRPC remark String API描述。字符长度不超过255 说明: 中文字符必须为UTF-8或者unicode编码。 group_id String API所属的分组编号 body_remark String API请求体描述,可以是请求体示例、媒体类型、参数等信息。字符长度不超过20480 说明: 中文字符必须为UTF-8或者unicode编码。 result_normal_sample String 正常响应示例,描述API的正常返回信息。字符长度不超过20480 说明: 中文字符必须为UTF-8或者unicode编码。 当API的请求协议为GRPC类型时不支持配置。 result_failure_sample String 失败返回示例,描述API的异常返回信息。字符长度不超过20480 说明: 中文字符必须为UTF-8或者unicode编码。 当API的请求协议为GRPC类型时不支持配置。 authorizer_id String 前端自定义认证对象的ID,API请求协议为GRPC类型时不支持前端自定义认证 tags Array of strings 标签。 支持英文,数字,中文,特殊符号(-*#%.:_),且只能以中文或英文开头。 默认支持10个标签,如需扩大配额请联系技术工程师修改API_TAG_NUM_LIMIT配置。 最小长度:1 最大长度:128 response_id String 分组自定义响应ID roma_app_id String 集成应用ID 暂不支持 domain_name String API绑定的自定义域名 暂不支持 tag String 标签 待废弃,优先使用tags字段 content_type String 请求内容格式类型: application/json application/xml multipart/form-data text/plain 暂不支持 枚举值: application/json application/xml multipart/form-data text/plain id String API编号 status Integer API状态 1: 有效 arrange_necessary Integer 是否需要编排 register_time String API注册时间 update_time String API修改时间 group_name String API所属分组的名称 group_version String API所属分组的版本 默认V1,其他版本暂不支持 缺省值:V1 run_env_id String 发布的环境编号 存在多个发布记录时,环境编号之间用|隔开 run_env_name String 发布的环境名称 存在多个发布记录时,环境名称之间用|隔开 publish_id String 发布记录编号 存在多个发布记录时,发布记录编号之间用|隔开 publish_time String 发布时间 存在多个发布记录时,发布时间之间用|隔开 roma_app_name String API归属的集成应用名称 暂不支持 ld_api_id String 当API的后端为自定义后端时,对应的自定义后端API编号 暂不支持 backend_api BackendApi object web后端详情 api_group_info ApiGroupCommonInfo object api分组信息 func_info ApiFunc object 函数工作流后端详情 mock_info ApiMock object mock后端详情 req_params Array of ReqParam objects API的请求参数列表 backend_params Array of BackendParam objects API的后端参数列表 policy_functions Array of ApiPolicyFunctionResp objects 函数工作流策略后端列表 policy_mocks Array of ApiPolicyMockResp objects mock策略后端列表 policy_https Array of ApiPolicyHttpResp objects web策略后端列表 表16 AuthOpt 参数 参数类型 描述 app_code_auth_type String AppCode简易认证类型,仅在auth_type为APP时生效,默认为DISABLE: DISABLE:不开启简易认证 HEADER:开启简易认证且AppCode位置在HEADER 缺省值:DISABLE 枚举值: DISABLE HEADER 表17 BackendApi 参数 参数类型 描述 authorizer_id String 后端自定义认证对象的ID,后端类型为GRPC时不支持后端自定义认证 url_domain String 后端服务的地址。 由主机(IP或域名)和端口号组成,总长度不超过255。格式为主机:端口(如:apig.example.com:7443)。如果不写端口,则HTTPS默认端口号为443,HTTP默认端口号为80。 支持环境变量,使用环境变量时,每个变量名的长度为3 ~ 32位的字符串,字符串由英文字母、数字、下划线、中划线组成,且只能以英文开头 req_protocol String 请求协议,后端类型为GRPC时请求协议可选GRPCS 枚举值: HTTP HTTPS GRPCS remark String 描述。字符长度不超过255 说明: 中文字符必须为UTF-8或者unicode编码。 req_method String 请求方式,后端类型为GRPC时请求方式固定为POST 枚举值: GET POST PUT DELETE HEAD PATCH OPTIONS ANY version String web后端版本,字符长度不超过16 req_uri String 请求地址。可以包含请求参数,用{}标识,比如/getUserInfo/{userId},支持 * / %- _ . 等特殊字符,总长度不超过512,且满足URI规范。 支持环境变量,使用环境变量时,每个变量名的长度为3 ~ 32位的字符串,字符串由英文字母、数字、中划线、下划线组成,且只能以英文开头。 说明: 需要服从URI规范。 后端类型为GRPC时请求地址固定为/ timeout Integer API网关请求后端服务的超时时间。最大超时时间可通过实例特性backend_timeout配置修改,可修改的上限为600000。 单位:毫秒。 最小值:1 enable_client_ssl Boolean 是否开启双向认证 retry_count String 请求后端服务的重试次数,默认为-1,范围[-1,10]。 当该值为-1时,幂等的接口会重试1次,非幂等的不会重试。POST,PATCH方法为非幂等;GET,HEAD,PUT,OPTIONS和DELETE等方法为幂等的。 缺省值:-1 id String 编号 status Integer 后端状态 1: 有效 register_time String 注册时间 update_time String 修改时间 vpc_channel_info VpcInfo object VPC通道详情。如果vpc_channel_status = 1,则这个object类型为必填信息 vpc_channel_status Integer 是否使用VPC通道 1:使用VPC通道 2:不使用VPC通道 表18 ApiGroupCommonInfo 参数 参数类型 描述 id String 编号 name String API分组名称 status Integer 状态 1: 有效 枚举值: 1 sl_domain String 系统默认分配的子域名 register_time String 创建时间 update_time String 最近修改时间 on_sell_status Integer 是否已上架云商店: 1:已上架 2:未上架 3:审核中 url_domains Array of UrlDomain objects 分组上绑定的独立域名列表 sl_domain_access_enabled Boolean 调试域名是否可以访问,true表示可以访问,false表示禁止访问 缺省值:true 表19 UrlDomain 参数 参数类型 描述 id String 域名编号 domain String 访问域名 cname_status Integer 域名cname状态: 1:未解析 2:解析中 3:解析成功 4:解析失败 ssl_id String SSL证书编号 ssl_name String SSL证书名称 min_ssl_version String 最小ssl协议版本号。支持TLSv1.1或TLSv1.2 缺省值:TLSv1.1 枚举值: TLSv1.1 TLSv1.2 verified_client_certificate_enabled Boolean 是否开启客户端证书校验。只有绑定证书时,该参数才生效。当绑定证书存在trusted_root_ca时,默认开启;当绑定证书不存在trusted_root_ca时,默认关闭。 缺省值:false is_has_trusted_root_ca Boolean 是否存在信任的根证书CA。当绑定证书存在trusted_root_ca时为true。 缺省值:false 表20 ApiFunc 参数 参数类型 描述 function_urn String 函数URN remark String 描述信息。长度不超过255个字符 说明: 中文字符必须为UTF-8或者unicode编码。 invocation_type String 调用类型 async: 异步 sync:同步 枚举值: async sync network_type String 对接函数的网络架构类型 V1:非VPC网络架构 V2:VPC网络架构 枚举值: V1 V2 version String 函数版本 当函数别名URN和函数版本同时传入时,函数版本将被忽略,只会使用函数别名URN 最大长度:64 alias_urn String 函数别名URN 当函数别名URN和函数版本同时传入时,函数版本将被忽略,只会使用函数别名URN timeout Integer API网关请求后端服务的超时时间。函数网络架构为V1时最大超时时间为60000,V2最大超时时间可通过实例特性backend_timeout配置修改,可修改的上限为600000。 单位:毫秒。 最小值:1 authorizer_id String 后端自定义认证ID req_protocol String 函数后端的请求协议:HTTPS、GRPCS,默认值为HTTPS,前端配置中的请求协议为GRPCS时可选GRPCS。 缺省值:HTTPS 枚举值: HTTPS GRPCS id String 编号 register_time String 注册时间 status Integer 后端状态 1: 有效 update_time String 修改时间 表21 ApiMock 参数 参数类型 描述 remark String 描述信息。长度不超过255个字符 说明: 中文字符必须为UTF-8或者unicode编码。 result_content String 返回结果 version String 版本。字符长度不超过64 authorizer_id String 后端自定义认证ID id String 编号 register_time String 注册时间 status Integer 后端状态 1: 有效 update_time String 修改时间 表22 ReqParam 参数 参数类型 描述 name String 参数名称。 长度为1 ~ 32位的字符串,字符串由英文字母、数字、中划线、下划线、英文句号组成,且只能以英文开头。 type String 参数类型 枚举值: STRING NUMBER location String 参数位置 枚举值: PATH QUERY HEADER default_value String 参数默认值 sample_value String 参数示例值 required Integer 是否必须 1:是 2:否 location为PATH时,required默认为1,其他场景required默认为2 枚举值: 1 2 valid_enable Integer 是否开启校验 1:开启校验 2:不开启校验 缺省值:2 枚举值: 1 2 remark String 描述信息。长度不超过255个字符 说明: 中文字符必须为UTF-8或者unicode编码。 enumerations String 参数枚举值 min_num Integer 参数最小值 参数类型为NUMBER时有效 max_num Integer 参数最大值 参数类型为NUMBER时有效 min_size Integer 参数最小长度 参数类型为STRING时有效 max_size Integer 参数最大长度 参数类型为STRING时有效 regular String 正则校验规则 暂不支持 json_schema String JSON校验规则 暂不支持 pass_through Integer 是否透传 1:是 2:否 枚举值: 1 2 id String 参数编号 表23 ApiPolicyFunctionResp 参数 参数类型 描述 function_urn String 函数URN invocation_type String 调用类型 async: 异步 sync:同步 枚举值: async sync network_type String 对接函数的网络架构类型 V1:非VPC网络架构 V2:VPC网络架构 枚举值: V1 V2 version String 函数版本 当函数别名URN和函数版本同时传入时,函数版本将被忽略,只会使用函数别名URN 最大长度:64 alias_urn String 函数别名URN 当函数别名URN和函数版本同时传入时,函数版本将被忽略,只会使用函数别名URN timeout Integer API网关请求后端服务的超时时间。函数网络架构为V1时最大超时时间为60000,V2最大超时时间可通过实例特性backend_timeout配置修改,可修改的上限为600000。 单位:毫秒。 最小值:1 req_protocol String 函数后端的请求协议:HTTPS、GRPCS,默认值为HTTPS,前端配置中的请求协议为GRPCS时可选GRPCS。 缺省值:HTTPS 枚举值: HTTPS GRPCS id String 编号 effect_mode String 关联的策略组合模式: ALL:满足全部条件 ANY:满足任一条件 枚举值: ALL ANY name String 策略后端名称。字符串由中文、英文字母、数字、下划线组成,且只能以中文或英文开头。 最小长度:3 最大长度:64 backend_params Array of BackendParam objects 后端参数列表 conditions Array of CoditionResp objects 策略条件列表 authorizer_id String 后端自定义认证对象的ID 表24 ApiPolicyMockResp 参数 参数类型 描述 id String 编号 effect_mode String 关联的策略组合模式: ALL:满足全部条件 ANY:满足任一条件 枚举值: ALL ANY name String 策略后端名称。字符串由中文、英文字母、数字、下划线组成,且只能以中文或英文开头。 最小长度:3 最大长度:64 backend_params Array of BackendParam objects 后端参数列表 conditions Array of CoditionResp objects 策略条件列表 authorizer_id String 后端自定义认证对象的ID result_content String 返回结果 表25 ApiPolicyHttpResp 参数 参数类型 描述 id String 编号 effect_mode String 关联的策略组合模式: ALL:满足全部条件 ANY:满足任一条件 枚举值: ALL ANY name String 策略后端名称。字符串由中文、英文字母、数字、下划线组成,且只能以中文或英文开头。 最小长度:3 最大长度:64 backend_params Array of BackendParam objects 后端参数列表 conditions Array of CoditionResp objects 策略条件列表 authorizer_id String 后端自定义认证对象的ID url_domain String 策略后端的Endpoint。 由域名(或IP地址)和端口号组成,总长度不超过255。格式为域名:端口(如:apig.example.com:7443)。如果不写端口,则HTTPS默认端口号为443, HTTP默认端口号为80。 支持环境变量,使用环境变量时,每个变量名的长度为3 ~ 32位的字符串,字符串由英文字母、数字、“_”、“-”组成,且只能以英文开头。 req_protocol String 请求协议:HTTP、HTTPS、GRPCS,后端类型为GRPC时可选GRPCS 枚举值: HTTP HTTPS GRPCS req_method String 请求方式:GET、POST、PUT、DELETE、HEAD、PATCH、OPTIONS、ANY,后端类型为GRPC时固定为POST 枚举值: GET POST PUT DELETE HEAD PATCH OPTIONS ANY req_uri String 请求地址。可以包含请求参数,用{}标识,比如/getUserInfo/{userId},支持 * / %- _ . 等特殊字符,总长度不超过512,且满足URI规范。 支持环境变量,使用环境变量时,每个变量名的长度为3 ~ 32位的字符串,字符串由英文字母、数字、中划线、下划线组成,且只能以英文开头。 说明: 需要服从URI规范。 后端类型为GRPC时请求地址固定为/ timeout Integer API网关请求后端服务的超时时间。最大超时时间可通过实例特性backend_timeout配置修改,可修改的上限为600000。 单位:毫秒。 最小值:1 retry_count String 请求后端服务的重试次数,默认为-1,范围[-1,10]。 当该值为-1时,幂等的接口会重试1次,非幂等的不会重试。POST,PATCH方法为非幂等;GET,HEAD,PUT,OPTIONS和DELETE等方法为幂等的。 缺省值:-1 vpc_channel_info VpcInfo object VPC通道详情。如果vpc_channel_status = 1,则这个object类型为必填信息 vpc_channel_status Integer 是否使用VPC通道: 1: 使用VPC通道 2:不使用VPC通道 表26 BackendParam 参数 参数类型 描述 origin String 参数类别: 后端服务参数:REQUEST 常量参数:CONSTANT 系统参数:SYSTEM 枚举值: REQUEST CONSTANT SYSTEM name String 参数名称。 字符串由英文字母、数字、中划线、下划线、英文句号组成,且只能以英文开头。 最小长度:1 最大长度:32 remark String 描述。字符长度不超过255 说明: 中文字符必须为UTF-8或者unicode编码。 location String 参数位置:PATH、QUERY、HEADER 枚举值: PATH QUERY HEADER value String 参数值。字符长度不超过255 origin类别为REQUEST时,此字段值为req_params中的参数名称; origin类别为CONSTANT时,此字段值为参数真正的值; origin类别为SYSTEM时,此字段值为系统参数名称,系统参数分为网关内置参数、前端认证参数和后端认证参数,当api前端安全认证方式为自定义认证时,可以填写前端认证参数,当api开启后端认证时,可以填写后端认证参数。 网关内置参数取值及对应含义: $context.sourceIp:API调用者的源地址 $context.stage:API调用的部署环境 $context.apiId:API的ID $context.appId:API调用者的APP对象ID $context.requestId:当次API调用生成请求ID $context.serverAddr:网关的服务器地址 $context.serverName:网关的服务器名称 $context.handleTime:本次API调用的处理时间 $context.providerAppId:API拥有者的应用对象ID,暂不支持使用 前端认证参数取值:以“$context.authorizer.frontend.”为前缀,如希望自定义认证校验通过返回的参数为aaa,那么此字段填写为$context.authorizer.frontend.aaa 后端认证参数取值:以“$context.authorizer.backend.”为前缀,如希望自定义认证校验通过返回的参数为aaa,那么此字段填写为$context.authorizer.backend.aaa id String 参数编号 req_param_id String 对应的请求参数编号 表27 CoditionResp 参数 参数类型 描述 req_param_name String 关联的请求参数对象名称。策略类型为param时必选 sys_param_name String 系统参数-网关内置参数名称。策略类型为system时必选。支持以下参数 req_path:请求路径。如 /a/b req_method:请求方法。如 GET reqPath:请求路径,废弃。如 /a/b reqMethod:请求方法,废弃。如 GET 枚举值: req_path req_method reqPath reqMethod cookie_param_name String COOKIE参数名称。策略类型为cookie时必选 最小长度:0 最大长度:255 frontend_authorizer_param_name String 系统参数-前端认证参数名称。策略类型为frontend_authorizer时必选,前端认证参数名称以"$context.authorizer.frontend."字符串为前缀。例如,前端认证参数名称为user_name,加上前缀为$context.authorizer.frontend.user_name。 condition_type String 策略条件 exact:绝对匹配 enum:枚举 pattern:正则 策略类型为param,system,cookie,frontend_authorizer时必选 枚举值: exact enum pattern condition_origin String 策略类型 param:参数 source:源IP system: 系统参数-网关内置参数 cookie: COOKIE参数 frontend_authorizer: 系统参数-前端认证参数 枚举值: param source system cookie frontend_authorizer condition_value String 策略值。策略类型为param,source,cookie,frontend_authorizer时必填 id String 编号 req_param_id String 关联的请求参数对象编号 req_param_location String 关联的请求参数对象位置 表28 VpcInfo 参数 参数类型 描述 ecs_id String 云服务器ID ecs_name String 云服务器名称 cascade_flag Boolean 是否使用级联方式 暂不支持 vpc_channel_proxy_host String 代理主机 vpc_channel_id String VPC通道编号 vpc_channel_port Integer VPC通道端口 状态码: 400 表29 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 401 表30 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 403 表31 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 404 表32 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述 状态码: 500 表33 响应Body参数 参数 参数类型 描述 error_code String 错误码 error_msg String 错误描述
  • 请求参数 表2 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 是 String 用户Token。通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 表3 请求Body参数 参数 是否必选 参数类型 描述 name 是 String API名称。 支持汉字、英文、数字、中划线、下划线、点、斜杠、中英文格式下的小括号和冒号、中文格式下的顿号,且只能以英文、汉字和数字开头,3-255个字符。 说明: 中文字符必须为UTF-8或者unicode编码。 type 是 Integer API类型 1:公有API 2:私有API 枚举值: 1 2 version 否 String API的版本 最大长度:16 req_protocol 是 String API的请求协议 HTTP HTTPS BOTH:同时支持HTTP和HTTPS GRPCS 缺省值:HTTPS 枚举值: HTTP HTTPS BOTH GRPCS req_method 是 String API的请求方式,当API的请求协议为GRPC类型协议时请求方式固定为POST。 枚举值: GET POST PUT DELETE HEAD PATCH OPTIONS ANY req_uri 是 String 请求地址。可以包含请求参数,用{}标识,比如/getUserInfo/{userId},支持 * / %- _ . 等特殊字符,总长度不超过512,且满足URI规范。 说明: 需要服从URI规范。 auth_type 是 String API的认证方式 NONE:无认证 APP:APP认证 IAM:IAM认证 AUTHORIZER:自定义认证,当auth_type取值为AUTHORIZER时,authorizer_id字段必须传入 当API的请求协议为GRPC类型时不支持自定义认证。 枚举值: NONE APP IAM AUTHORIZER auth_opt 否 AuthOpt object 认证方式参数 cors 否 Boolean 是否支持跨域 TRUE:支持 FALSE:不支持 缺省值:false 枚举值: true false match_mode 否 String API的匹配方式 SWA:前缀匹配 NORMAL:正常匹配(绝对匹配) 默认:NORMAL 枚举值: SWA NORMAL backend_type 是 String 后端类型 HTTP:web后端 FUNCTION:函数工作流,当backend_type取值为FUNCTION时,func_info字段必须传入 MOCK:模拟的后端,当backend_type取值为MOCK时,mock_info字段必须传入 GRPC:grpc后端 枚举值: HTTP FUNCTION MOCK GRPC remark 否 String API描述。字符长度不超过255 说明: 中文字符必须为UTF-8或者unicode编码。 group_id 是 String API所属的分组编号 body_remark 否 String API请求体描述,可以是请求体示例、媒体类型、参数等信息。字符长度不超过20480 说明: 中文字符必须为UTF-8或者unicode编码。 result_normal_sample 否 String 正常响应示例,描述API的正常返回信息。字符长度不超过20480 说明: 中文字符必须为UTF-8或者unicode编码。 当API的请求协议为GRPC类型时不支持配置。 result_failure_sample 否 String 失败返回示例,描述API的异常返回信息。字符长度不超过20480 说明: 中文字符必须为UTF-8或者unicode编码。 当API的请求协议为GRPC类型时不支持配置。 authorizer_id 否 String 前端自定义认证对象的ID,API请求协议为GRPC类型时不支持前端自定义认证 tags 否 Array of strings 标签。 支持英文,数字,中文,特殊符号(-*#%.:_),且只能以中文或英文开头。 默认支持10个标签,如需扩大配额请联系技术工程师修改API_TAG_NUM_LIMIT配置。 最小长度:1 最大长度:128 response_id 否 String 分组自定义响应ID roma_app_id 否 String 集成应用ID 暂不支持 domain_name 否 String API绑定的自定义域名 暂不支持 tag 否 String 标签 待废弃,优先使用tags字段 content_type 否 String 请求内容格式类型: application/json application/xml multipart/form-data text/plain 暂不支持 枚举值: application/json application/xml multipart/form-data text/plain mock_info 否 ApiMockCreate object mock后端详情 func_info 否 ApiFuncCreate object 函数后端详情 req_params 否 Array of ReqParamBase objects API的请求参数列表,API请求协议为GRPC类型时不支持配置 backend_params 否 Array of BackendParamBase objects API的后端参数列表,API请求协议为GRPC类型时不支持配置 policy_mocks 否 Array of ApiPolicyMockCreate objects mock策略后端列表 policy_functions 否 Array of ApiPolicyFunctionCreate objects 函数工作流策略后端列表 backend_api 否 BackendApiCreate object web后端详情 policy_https 否 Array of ApiPolicyHttpCreate objects web策略后端列表 表4 AuthOpt 参数 是否必选 参数类型 描述 app_code_auth_type 否 String AppCode简易认证类型,仅在auth_type为APP时生效,默认为DISABLE: DISABLE:不开启简易认证 HEADER:开启简易认证且AppCode位置在HEADER 缺省值:DISABLE 枚举值: DISABLE HEADER 表5 ApiMockCreate 参数 是否必选 参数类型 描述 remark 否 String 描述信息。长度不超过255个字符 说明: 中文字符必须为UTF-8或者unicode编码。 result_content 否 String 返回结果 version 否 String 版本。字符长度不超过64 authorizer_id 否 String 后端自定义认证ID 表6 ApiFuncCreate 参数 是否必选 参数类型 描述 function_urn 是 String 函数URN remark 否 String 描述信息。长度不超过255个字符 说明: 中文字符必须为UTF-8或者unicode编码。 invocation_type 是 String 调用类型 async: 异步 sync:同步 枚举值: async sync network_type 是 String 对接函数的网络架构类型 V1:非VPC网络架构 V2:VPC网络架构 枚举值: V1 V2 version 否 String 函数版本 当函数别名URN和函数版本同时传入时,函数版本将被忽略,只会使用函数别名URN 最大长度:64 alias_urn 否 String 函数别名URN 当函数别名URN和函数版本同时传入时,函数版本将被忽略,只会使用函数别名URN timeout 是 Integer API网关请求后端服务的超时时间。函数网络架构为V1时最大超时时间为60000,V2最大超时时间可通过实例特性backend_timeout配置修改,可修改的上限为600000。 单位:毫秒。 最小值:1 authorizer_id 否 String 后端自定义认证ID req_protocol 否 String 函数后端的请求协议:HTTPS、GRPCS,默认值为HTTPS,前端配置中的请求协议为GRPCS时可选GRPCS。 缺省值:HTTPS 枚举值: HTTPS GRPCS 表7 ReqParamBase 参数 是否必选 参数类型 描述 name 是 String 参数名称。 长度为1 ~ 32位的字符串,字符串由英文字母、数字、中划线、下划线、英文句号组成,且只能以英文开头。 type 是 String 参数类型 枚举值: STRING NUMBER location 是 String 参数位置 枚举值: PATH QUERY HEADER default_value 否 String 参数默认值 sample_value 否 String 参数示例值 required 否 Integer 是否必须 1:是 2:否 location为PATH时,required默认为1,其他场景required默认为2 枚举值: 1 2 valid_enable 否 Integer 是否开启校验 1:开启校验 2:不开启校验 缺省值:2 枚举值: 1 2 remark 否 String 描述信息。长度不超过255个字符 说明: 中文字符必须为UTF-8或者unicode编码。 enumerations 否 String 参数枚举值 min_num 否 Integer 参数最小值 参数类型为NUMBER时有效 max_num 否 Integer 参数最大值 参数类型为NUMBER时有效 min_size 否 Integer 参数最小长度 参数类型为STRING时有效 max_size 否 Integer 参数最大长度 参数类型为STRING时有效 regular 否 String 正则校验规则 暂不支持 json_schema 否 String JSON校验规则 暂不支持 pass_through 否 Integer 是否透传 1:是 2:否 枚举值: 1 2 表8 ApiPolicyMockCreate 参数 是否必选 参数类型 描述 result_content 否 String 返回结果 effect_mode 是 String 关联的策略组合模式: ALL:满足全部条件 ANY:满足任一条件 枚举值: ALL ANY name 是 String 策略后端名称。字符串由中文、英文字母、数字、下划线组成,且只能以中文或英文开头。 最小长度:3 最大长度:64 backend_params 否 Array of BackendParamBase objects 后端参数列表,后端类型为GRPC时不支持配置 conditions 是 Array of ApiConditionBase objects 策略条件列表 authorizer_id 否 String 后端自定义认证对象的ID,后端类型为GRPC时不支持后端自定义认证 表9 ApiPolicyFunctionCreate 参数 是否必选 参数类型 描述 function_urn 是 String 函数URN invocation_type 是 String 调用类型 async: 异步 sync:同步 枚举值: async sync network_type 是 String 对接函数的网络架构类型 V1:非VPC网络架构 V2:VPC网络架构 枚举值: V1 V2 version 否 String 函数版本 当函数别名URN和函数版本同时传入时,函数版本将被忽略,只会使用函数别名URN 最大长度:64 alias_urn 否 String 函数别名URN 当函数别名URN和函数版本同时传入时,函数版本将被忽略,只会使用函数别名URN timeout 否 Integer API网关请求后端服务的超时时间。函数网络架构为V1时最大超时时间为60000,V2最大超时时间可通过实例特性backend_timeout配置修改,可修改的上限为600000。 单位:毫秒。 最小值:1 req_protocol 否 String 函数后端的请求协议:HTTPS、GRPCS,默认值为HTTPS,前端配置中的请求协议为GRPCS时可选GRPCS。 缺省值:HTTPS 枚举值: HTTPS GRPCS effect_mode 是 String 关联的策略组合模式: ALL:满足全部条件 ANY:满足任一条件 枚举值: ALL ANY name 是 String 策略后端名称。字符串由中文、英文字母、数字、下划线组成,且只能以中文或英文开头。 最小长度:3 最大长度:64 backend_params 否 Array of BackendParamBase objects 后端参数列表,后端类型为GRPC时不支持配置 conditions 是 Array of ApiConditionBase objects 策略条件列表 authorizer_id 否 String 后端自定义认证对象的ID,后端类型为GRPC时不支持后端自定义认证 表10 BackendApiCreate 参数 是否必选 参数类型 描述 authorizer_id 否 String 后端自定义认证对象的ID,后端类型为GRPC时不支持后端自定义认证 url_domain 否 String 后端服务的地址。 由主机(IP或域名)和端口号组成,总长度不超过255。格式为主机:端口(如:apig.example.com:7443)。如果不写端口,则HTTPS默认端口号为443,HTTP默认端口号为80。 支持环境变量,使用环境变量时,每个变量名的长度为3 ~ 32位的字符串,字符串由英文字母、数字、下划线、中划线组成,且只能以英文开头 req_protocol 是 String 请求协议,后端类型为GRPC时请求协议可选GRPCS 枚举值: HTTP HTTPS GRPCS remark 否 String 描述。字符长度不超过255 说明: 中文字符必须为UTF-8或者unicode编码。 req_method 是 String 请求方式,后端类型为GRPC时请求方式固定为POST 枚举值: GET POST PUT DELETE HEAD PATCH OPTIONS ANY version 否 String web后端版本,字符长度不超过16 req_uri 是 String 请求地址。可以包含请求参数,用{}标识,比如/getUserInfo/{userId},支持 * / %- _ . 等特殊字符,总长度不超过512,且满足URI规范。 支持环境变量,使用环境变量时,每个变量名的长度为3 ~ 32位的字符串,字符串由英文字母、数字、中划线、下划线组成,且只能以英文开头。 说明: 需要服从URI规范。 后端类型为GRPC时请求地址固定为/ timeout 是 Integer API网关请求后端服务的超时时间。最大超时时间可通过实例特性backend_timeout配置修改,可修改的上限为600000。 单位:毫秒。 最小值:1 enable_client_ssl 否 Boolean 是否开启双向认证 retry_count 否 String 请求后端服务的重试次数,默认为-1,范围[-1,10]。 当该值为-1时,幂等的接口会重试1次,非幂等的不会重试。POST,PATCH方法为非幂等;GET,HEAD,PUT,OPTIONS和DELETE等方法为幂等的。 缺省值:-1 vpc_channel_info 否 ApiBackendVpcReq object VPC通道详情。vpc_channel_status = 1,则这个object类型为必填信息 vpc_channel_status 否 Integer 是否使用VPC通道 1:使用VPC通道 2:不使用VPC通道 枚举值: 1 2 表11 ApiPolicyHttpCreate 参数 是否必选 参数类型 描述 url_domain 否 String 策略后端的Endpoint。 由域名(或IP地址)和端口号组成,总长度不超过255。格式为域名:端口(如:apig.example.com:7443)。如果不写端口,则HTTPS默认端口号为443, HTTP默认端口号为80。 支持环境变量,使用环境变量时,每个变量名的长度为3 ~ 32位的字符串,字符串由英文字母、数字、“_”、“-”组成,且只能以英文开头。 req_protocol 是 String 请求协议:HTTP、HTTPS、GRPCS,后端类型为GRPC时可选GRPCS 枚举值: HTTP HTTPS GRPCS req_method 是 String 请求方式:GET、POST、PUT、DELETE、HEAD、PATCH、OPTIONS、ANY,后端类型为GRPC时固定为POST 枚举值: GET POST PUT DELETE HEAD PATCH OPTIONS ANY req_uri 是 String 请求地址。可以包含请求参数,用{}标识,比如/getUserInfo/{userId},支持 * / %- _ . 等特殊字符,总长度不超过512,且满足URI规范。 支持环境变量,使用环境变量时,每个变量名的长度为3 ~ 32位的字符串,字符串由英文字母、数字、中划线、下划线组成,且只能以英文开头。 说明: 需要服从URI规范。 后端类型为GRPC时请求地址固定为/ timeout 否 Integer API网关请求后端服务的超时时间。最大超时时间可通过实例特性backend_timeout配置修改,可修改的上限为600000。 单位:毫秒。 最小值:1 retry_count 否 String 请求后端服务的重试次数,默认为-1,范围[-1,10]。 当该值为-1时,幂等的接口会重试1次,非幂等的不会重试。POST,PATCH方法为非幂等;GET,HEAD,PUT,OPTIONS和DELETE等方法为幂等的。 缺省值:-1 effect_mode 是 String 关联的策略组合模式: ALL:满足全部条件 ANY:满足任一条件 枚举值: ALL ANY name 是 String 策略后端名称。字符串由中文、英文字母、数字、下划线组成,且只能以中文或英文开头。 最小长度:3 最大长度:64 backend_params 否 Array of BackendParamBase objects 后端参数列表,后端类型为GRPC时不支持配置 conditions 是 Array of ApiConditionBase objects 策略条件列表 authorizer_id 否 String 后端自定义认证对象的ID,后端类型为GRPC时不支持后端自定义认证 vpc_channel_info 否 ApiBackendVpcReq object VPC通道详情。vpc_channel_status = 1,则这个object类型为必填信息 vpc_channel_status 否 Integer 是否使用VPC通道 1 : 使用VPC通道 2 : 不使用VPC通道 枚举值: 1 2 表12 BackendParamBase 参数 是否必选 参数类型 描述 origin 是 String 参数类别: 后端服务参数:REQUEST 常量参数:CONSTANT 系统参数:SYSTEM 枚举值: REQUEST CONSTANT SYSTEM name 是 String 参数名称。 字符串由英文字母、数字、中划线、下划线、英文句号组成,且只能以英文开头。 最小长度:1 最大长度:32 remark 否 String 描述。字符长度不超过255 说明: 中文字符必须为UTF-8或者unicode编码。 location 是 String 参数位置:PATH、QUERY、HEADER 枚举值: PATH QUERY HEADER value 是 String 参数值。字符长度不超过255 origin类别为REQUEST时,此字段值为req_params中的参数名称; origin类别为CONSTANT时,此字段值为参数真正的值; origin类别为SYSTEM时,此字段值为系统参数名称,系统参数分为网关内置参数、前端认证参数和后端认证参数,当api前端安全认证方式为自定义认证时,可以填写前端认证参数,当api开启后端认证时,可以填写后端认证参数。 网关内置参数取值及对应含义: $context.sourceIp:API调用者的源地址 $context.stage:API调用的部署环境 $context.apiId:API的ID $context.appId:API调用者的APP对象ID $context.requestId:当次API调用生成请求ID $context.serverAddr:网关的服务器地址 $context.serverName:网关的服务器名称 $context.handleTime:本次API调用的处理时间 $context.providerAppId:API拥有者的应用对象ID,暂不支持使用 前端认证参数取值:以“$context.authorizer.frontend.”为前缀,如希望自定义认证校验通过返回的参数为aaa,那么此字段填写为$context.authorizer.frontend.aaa 后端认证参数取值:以“$context.authorizer.backend.”为前缀,如希望自定义认证校验通过返回的参数为aaa,那么此字段填写为$context.authorizer.backend.aaa 表13 ApiConditionBase 参数 是否必选 参数类型 描述 req_param_name 否 String 关联的请求参数对象名称。策略类型为param时必选 sys_param_name 否 String 系统参数-网关内置参数名称。策略类型为system时必选。支持以下参数 req_path:请求路径。如 /a/b req_method:请求方法。如 GET reqPath:请求路径,废弃。如 /a/b reqMethod:请求方法,废弃。如 GET 枚举值: req_path req_method reqPath reqMethod cookie_param_name 否 String COOKIE参数名称。策略类型为cookie时必选 最小长度:0 最大长度:255 frontend_authorizer_param_name 否 String 系统参数-前端认证参数名称。策略类型为frontend_authorizer时必选,前端认证参数名称以"$context.authorizer.frontend."字符串为前缀。例如,前端认证参数名称为user_name,加上前缀为$context.authorizer.frontend.user_name。 condition_type 否 String 策略条件 exact:绝对匹配 enum:枚举 pattern:正则 策略类型为param,system,cookie,frontend_authorizer时必选 枚举值: exact enum pattern condition_origin 是 String 策略类型 param:参数 source:源IP system: 系统参数-网关内置参数 cookie: COOKIE参数 frontend_authorizer: 系统参数-前端认证参数 枚举值: param source system cookie frontend_authorizer condition_value 是 String 策略值。策略类型为param,source,cookie,frontend_authorizer时必填 表14 ApiBackendVpcReq 参数 是否必选 参数类型 描述 vpc_channel_proxy_host 否 String 代理主机 vpc_channel_id 是 String VPC通道编号
  • 支持HTTP2.0 API网关支持HTTP/2(超文本传输协议第2版)访问协议,通常称之HTTP2.0。拥有二进制格式编码、多路复用共享连接和请求头压缩的能力,改进传输性能,实现低延迟和高吞吐量。 由于HTTP2.0是强依赖网络稳定性的,建议用户在使用HTTP2.0时使用比较稳定的网络场景,而且客户端须支持HTTP2.0。 如果当前实例不支持HTTP2.0,请联系技术支持升级实例。 如需关闭HTTP2.0协议,在API网关控制台的“配置参数”页面中的“request_custom_config”参数下关闭HTTP/2协议即可。 Binary Format二进制格式 HTTP1.x以文本的形式传输,而HTTP2.0将所有传输信息分割为更小的消息和帧,并对它们采用二进制格式编码。相对于字符串(文本)解析,二进制格式解析更方便且不易出错,提升传输性能。 MultiPlexing多路复用 在二进制格式的基础上,HTTP2.0不再依赖多个连接去实现并行处理、发送请求及响应。 同域名下所有通信都在单个连接上完成;每个连接可以承载任意数量的消息;消息由一个或多个帧组成,多个帧之间可以乱序发送,最后可以根据帧首部的流标识重新组合。从而实现低延迟,提升效率。 Header压缩 HTTP2.0使用encoder来减少需要传输的Header大小,客户端与服务端各自保存一份Header fields表,避免重复header传输,减少传输大小,实现高吞吐量。 父主题: API管理
  • 响应示例 状态码: 200 OK { "total" : 1, "size" : 1, "apis" : [ { "name" : "Api_http", "type" : 1, "version" : "V0.0.1", "req_protocol" : "HTTPS", "req_method" : "GET", "req_uri" : "/test/http", "auth_type" : "AUTHORIZER", "auth_opt" : { "app_code_auth_type" : "DISABLE" }, "cors" : false, "match_mode" : "NORMAL", "backend_type" : "HTTP", "remark" : "Web backend API", "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "body_remark" : "", "result_normal_sample" : "", "result_failure_sample" : "", "authorizer_id" : "8d0443832a194eaa84244e0c1c1912ac", "tags" : [ "webApi" ], "roma_app_id" : "f37f5e81d9cb4424bf704ef2b0ac7600", "domain_name" : "", "id" : "5f918d104dc84480a75166ba99efff21", "status" : 1, "arrange_necessary" : 2, "register_time" : "2020-07-31T12:42:51Z", "update_time" : "2020-08-02T16:32:47.046289Z", "group_name" : "api_group_001", "group_version" : "V1", "run_env_name" : "RELEASE", "run_env_id" : "DEFAULT_ENVIRONMENT_RELEASE_ID", "publish_id" : "6f918d104dc84480a75166ba99efff41", "publish_time" : "2020-07-31 12:42:51", "roma_app_name" : "roma-3xfg", "ld_api_id" : "", "backend_api" : null, "api_group_info" : null, "req_params" : null } ] } 状态码: 400 Bad Request { "error_code" : "APIG.2012", "error_msg" : "Invalid parameter value,parameterName:name. 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.3030", "error_msg" : "The instance does not exist;id:f0fa1789-3b76-433b-a787-9892951c620ec" } 状态码: 500 Internal Server Error { "error_code" : "APIG.9999", "error_msg" : "System error" }
  • 请求示例 创建Web后端API { "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "match_mode" : "NORMAL", "name" : "Api_http", "auth_type" : "AUTHORIZER", "authorizer_id" : "0d982c1ac3da493dae47627b6439fc5c", "backend_type" : "HTTP", "backend_api" : { "url_domain" : "10.10.10.156:12346", "req_protocol" : "HTTP", "req_method" : "GET", "req_uri" : "/test/benchmark", "timeout" : 5000 }, "req_protocol" : "HTTPS", "req_uri" : "/test/http", "remark" : "Web backend API", "type" : 1, "req_method" : "GET", "result_normal_sample" : "normal result", "result_failure_sample" : "failure result", "tags" : [ "webApi" ], "req_params" : [ { "name" : "query_demo", "location" : "QUERY", "type" : "STRING", "required" : 1 }, { "name" : "header-demo", "location" : "HEADER", "type" : "STRING", "required" : 2 } ], "backend_params" : [ { "name" : "backHeader", "value" : "header-demo", "location" : "HEADER", "origin" : "REQUEST" }, { "name" : "backQuery", "value" : "query_demo", "location" : "QUERY", "origin" : "REQUEST" }, { "name" : "X-CONSTANT-HEADER", "value" : "demo", "location" : "HEADER", "origin" : "CONSTANT", "remark" : "constant_demo" }, { "name" : "app-id", "value" : "$context.appId", "location" : "HEADER", "origin" : "SYSTEM", "remark" : "consumer app id" } ] } 创建函数工作流后端API { "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "match_mode" : "NORMAL", "name" : "Api_function", "auth_type" : "APP", "backend_type" : "FUNCTION", "func_info" : { "authorizer_id" : "5b8cd3f06f004115aec69c58f57272c9", "function_urn" : "'urn:fss:region01:73d69ae0cfcf460190522d06b60f05ad:function:default:auto_testfunc93749'", "invocation_type" : "sync", "timeout" : 5000, "version" : "latest" }, "req_protocol" : "HTTPS", "req_uri" : "/test/function", "remark" : "function API", "type" : 1, "req_method" : "GET", "result_normal_sample" : "normal result", "result_failure_sample" : "failure result", "tags" : [ "functionApi" ] } 创建模拟后端API { "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "match_mode" : "SWA", "name" : "Api_mock", "auth_type" : "IAM", "backend_type" : "MOCK", "mock_info" : { "result_content" : "mock success" }, "policy_mocks" : [ { "name" : "mock_policy_backend", "effect_mode" : "ANY", "result_content" : "mock policy success", "conditions" : [ { "condition_origin" : "source", "condition_value" : "1.0.1.0" } ] } ], "req_protocol" : "HTTPS", "req_uri" : "/test/mock", "remark" : "mock api", "type" : 1, "req_method" : "GET", "result_normal_sample" : "normal result", "result_failure_sample" : "failure result", "tags" : [ "mockApi" ] }
  • 响应示例 状态码: 201 Created 示例 1 { "id" : "5f918d104dc84480a75166ba99efff21", "tags" : [ "webApi" ], "arrange_necessary" : 2, "backend_type" : "HTTP", "auth_type" : "AUTHORIZER", "auth_opt" : { "app_code_auth_type" : "DISABLE" }, "authorizer_id" : "0d982c1ac3da493dae47627b6439fc5c", "backend_api" : { "update_time" : "2020-07-31T12:42:51.325312994Z", "vpc_status" : 2, "url_domain" : "10.10.10.156:12346", "req_protocol" : "HTTP", "id" : "1ce8fda3586d4371bd83c955df37e102", "req_method" : "GET", "register_time" : "2020-07-31T12:42:51.325312721Z", "req_uri" : "/benchmark", "timeout" : 5000, "status" : 1 }, "cors" : false, "status" : 1, "group_name" : "api_group_001", "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "group_version" : "V1", "response_id" : "981e6c8f847f47199a9faf4409b751a5", "match_mode" : "NORMAL", "name" : "Api_http", "req_protocol" : "HTTPS", "req_method" : "GET", "req_uri" : "/test/http", "type" : 1, "result_normal_sample" : "normal result", "result_failure_sample" : "failure result", "version" : "V0.0.1", "register_time" : "2020-07-31T12:42:51.314357035Z", "update_time" : "2020-07-31T12:42:51.314357324Z", "remark" : "Web backend API", "req_params" : [ { "name" : "query_demo", "location" : "QUERY", "type" : "STRING", "valid_enable" : 2, "required" : 1, "id" : "57c8bf3c97ef40ee94eace95dff30014", "pass_through" : 1 }, { "name" : "header-demo", "location" : "HEADER", "type" : "STRING", "valid_enable" : 2, "required" : 2, "id" : "8d993be96980415faa6b1fb2ebd647e0", "pass_through" : 1 } ], "backend_params" : [ { "name" : "backHeader", "value" : "header-demo", "location" : "HEADER", "origin" : "REQUEST", "id" : "709f0ea376b44aaf907aaaa37d8cce92", "req_param_id" : "8d993be96980415faa6b1fb2ebd647e0" }, { "name" : "backQuery", "value" : "query_demo", "location" : "QUERY", "origin" : "REQUEST", "id" : "2f152d0fb54445039158d29c2a4f69ee", "req_param_id" : "57c8bf3c97ef40ee94eace95dff30014" }, { "name" : "X-CONSTANT-HEADER", "value" : "demo", "location" : "HEADER", "origin" : "CONSTANT", "remark" : "constant_demo", "id" : "20142102c6aa4f3c97d5fd6ef4010ac2" }, { "name" : "app-id", "value" : "$context.appId", "location" : "HEADER", "origin" : "SYSTEM", "remark" : "consumer app id", "id" : "a1349c61016e4d999ca783a50bfeee2b" } ] } 示例 2 { "id" : "abd9c4b2ff974888b0ba79be7e6b2763", "arrange_necessary" : 2, "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "group_name" : "api_group_001", "group_version" : "V1", "match_mode" : "NORMAL", "name" : "Api_function", "auth_type" : "APP", "auth_opt" : { "auth_code_auth_type" : "DISABLE" }, "backend_type" : "FUNCTION", "func_info" : { "id" : "c0740524cd4c40e3801a7afe5375f8b0", "authorizer_id" : "5b8cd3f06f004115aec69c58f57272c9", "function_urn" : "'urn:fss:region01:73d69ae0cfcf460190522d06b60f05ad:function:default:auto_testfunc93749'", "invocation_type" : "sync", "timeout" : 5000, "version" : "latest", "register_time" : "2020-08-02T15:36:19.897262803Z", "update_time" : "2020-08-02T15:36:19.897262993Z", "status" : 1 }, "cors" : false, "req_protocol" : "HTTPS", "req_uri" : "/test/function", "remark" : "function api", "type" : 1, "version" : "V0.0.1", "status" : 1, "req_method" : "GET", "result_normal_sample" : "normal result", "result_failure_sample" : "failure result", "tags" : [ "functionApi" ], "register_time" : "2020-08-02T15:36:19.892012381Z", "update_time" : "2020-08-02T15:36:19.892012627Z" } 示例 3 { "id" : "3a955b791bd24b1c9cd94c745f8d1aad", "arrange_necessary" : 2, "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "group_name" : "api_group_001", "group_version" : "V1", "match_mode" : "SWA", "name" : "Api_mock", "auth_type" : "IAM", "auth_opt" : { "auth_code_auth_type" : "DISABLE" }, "backend_type" : "MOCK", "mock_info" : { "id" : "e74bbc75825c4c38ae84ccab6bdc6175", "result_content" : "mock success", "update_time" : "2020-08-02T15:56:52.301790686Z", "register_time" : "2020-08-02T15:56:52.301790367Z" }, "policy_mocks" : [ { "name" : "mock api", "id" : "1cb05173a4c84b7d996e30145cce3c7d", "effect_mode" : "ANY", "result_content" : "mock policy success", "conditions" : [ { "condition_origin" : "source", "condition_value" : "1.0.1.0", "id" : "8650b3a94e7344df8251658d8aee1f6d" } ] } ], "cors" : false, "req_protocol" : "HTTPS", "req_uri" : "/test/mock", "remark" : "mock api", "type" : 1, "version" : "V0.0.1", "req_method" : "GET", "result_normal_sample" : "normal result", "result_failure_sample" : "failure result", "tags" : [ "mockApi" ], "register_time" : "2020-08-02T15:56:52.286099413Z", "update_time" : "2020-08-02T15:56:52.286099715Z", "status" : 1 } 状态码: 400 Bad Request { "error_code" : "APIG.2011", "error_msg" : "Invalid parameter value,parameterName:name. 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.3019", "error_msg" : "The function URN does not exist" } 状态码: 500 Internal Server Error { "error_code" : "APIG.9999", "error_msg" : "System error" }
  • 响应示例 状态码: 200 OK { "total" : 3, "size" : 3, "apis" : [ { "arrange_necessary" : 2, "id" : "5f918d104dc84480a75166ba99efff21", "tags" : [ "webApi" ], "backend_type" : "HTTP", "auth_type" : "AUTHORIZER", "auth_opt" : { "app_code_auth_type" : "DISABLE" }, "authorizer_id" : "8d0443832a194eaa84244e0c1c1912ac", "cors" : false, "status" : 1, "group_name" : "api_group_001", "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "group_version" : "V1", "match_mode" : "NORMAL", "name" : "Api_http", "req_protocol" : "HTTPS", "req_method" : "GET", "req_uri" : "/test/http", "type" : 1, "version" : "V0.0.1", "register_time" : "2020-07-31T12:42:51Z", "update_time" : "2020-08-02T16:32:47.046289Z", "remark" : "web backend API" }, { "id" : "3a955b791bd24b1c9cd94c745f8d1aad", "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "group_name" : "api_group_001", "group_version" : "V1", "match_mode" : "SWA", "name" : "Api_mock", "auth_type" : "IAM", "auth_opt" : { "auth_code_auth_type" : "DISABLE" }, "backend_type" : "MOCK", "cors" : false, "req_protocol" : "HTTPS", "req_uri" : "/test/mock", "remark" : "mock api", "type" : 1, "version" : "V0.0.1", "req_method" : "GET", "result_normal_sample" : "normal result", "result_failure_sample" : "failure result", "tags" : [ "mockApi" ], "register_time" : "2020-08-02T15:56:52Z", "update_time" : "2020-08-02T15:56:52Z", "status" : 1 }, { "id" : "abd9c4b2ff974888b0ba79be7e6b2763", "arrange_necessary" : 2, "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "group_name" : "api_group_001", "group_version" : "V1", "match_mode" : "NORMAL", "name" : "Api_function", "auth_type" : "APP", "auth_opt" : { "auth_code_auth_type" : "DISABLE" }, "backend_type" : "FUNCTION", "cors" : false, "req_protocol" : "HTTPS", "req_uri" : "/test/function", "remark" : "function API", "type" : 1, "version" : "V0.0.1", "status" : 1, "req_method" : "GET", "tags" : [ "functionApi" ], "register_time" : "2020-08-02T15:36:19Z", "update_time" : "2020-08-02T15:47:53.499266Z" } ] } 状态码: 400 Bad Request { "error_code" : "APIG.2012", "error_msg" : "Invalid parameter value,parameterName:name. 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.3030", "error_msg" : "The instance does not exist;id:f0fa1789-3b76-433b-a787-9892951c620ec" } 状态码: 500 Internal Server Error { "error_code" : "APIG.9999", "error_msg" : "System error" }
  • 响应示例 状态码: 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.3002", "error_msg" : "API 5f918d104dc84480a75166ba99efff21 does not exist" } 状态码: 409 Conflict { "error_code" : "APIG.4016", "error_msg" : "The API cannot be deleted because it has been published" } 状态码: 500 Internal Server Error { "error_code" : "APIG.9999", "error_msg" : "System error" }