云服务器内容精选

  • 邀请其他企业用户 企业A的账号中创建项目后,可以向该项目中添加企业B的账号中的 IAM 用户。 前提条件请参照邀请其他企业用户为项目成员。 单击“添加成员”旁的下拉框,选择“邀请其他企业用户”。 弹出“邀请其他企业用户”对话框,在“企业用户”下拉列表框中选择被邀请用户所属的账号,选择邀请方式并输入对应ID,单击“确定”。 用户ID:被邀请用户的ID,通过“我的凭证 ”获取“IAM用户ID”。获取方式请参考API凭证。 委托ID:被邀请账号中已创建的委托ID,通过IAM服务中的“委托”页面获取。 单击“确定”,可以将其他企业用户添加到项目中。
  • 转换证书为PEM格式 格式类型 转换方式(通过OpenSSL工具进行转换) CER/CRT 将“cert.crt”证书文件直接重命名为“cert.pem”。 PFX 提取私钥命令,以“cert.pfx”转换为“key.pem”为例。 openssl pkcs12 -in cert.pfx -nocerts -out key.pem 提取证书命令,以“cert.pfx”转换为“cert.pem”为例。 openssl pkcs12 -in cert.pfx -nokeys -out cert.pem P7B 证书转换,以“cert.p7b”转换为“cert.cer”为例。 openssl pkcs7 -print_certs -in cert.p7b -out cert.cer 将“cert.cer”证书文件直接重命名为“cert.pem”。 DER 提取私钥命令,以“privatekey.der”转换为“privatekey.pem”为例。 openssl rsa -inform DER -outform PEM -in privatekey.der -out privatekey.pem 提取证书命令,以“cert.cer”转换为“cert.pem”为例。 openssl x509 -inform der -in cert.cer -out cert.pem
  • 响应示例 状态码: 201 Created 示例 1 { "name" : "Api_http", "type" : 1, "version" : "V2", "req_protocol" : "HTTP", "req_method" : "GET", "req_uri" : "/test/http", "auth_type" : "APP", "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" : "Normal response example", "result_failure_sample" : "Failure response example", "authorizer_id" : "", "tags" : [ "webApi" ], "roma_app_id" : "957dcd1e-d8f4-432e-8e71-df55cf772aba", "domain_name" : "", "tag" : "", "id" : "5f918d104dc84480a75166ba99efff21", "status" : 1, "arrange_necessary" : 2, "register_time" : "2022-02-09T02:46:36.913996908Z", "update_time" : "2022-02-09T02:46:36.913997175Z", "group_name" : "api_group_001", "group_version" : "V2", "run_env_name" : "", "run_env_id" : "", "publish_id" : "", "roma_app_name" : "app-htyr", "ld_api_id" : "", "backend_api" : { "authorizer_id" : "", "url_domain" : "10.10.10.156:12346", "req_protocol" : "HTTP", "remark" : "", "req_method" : "GET", "version" : "", "req_uri" : "/test/bechmark", "timeout" : 5000, "enable_client_ssl" : false, "retry_count" : "-1", "id" : "86686e62cabe44b392ad4a0856165e92", "status" : 1, "register_time" : "2022-02-09T02:46:36.914978278Z", "update_time" : "2022-02-09T02:46:36.914978525Z", "vpc_channel_info" : { "cascade_flag" : false, "vpc_channel_id" : "", "vpc_channel_port" : 0 }, "vpc_channel_status" : 2 }, "api_group_info" : { "id" : "02b157a33b394babb0b08c010bc3d76b", "name" : "api_group", "status" : 1, "sl_domain" : "02b157a33b394babb0b08c010bc3d76b.apic.****.com", "register_time" : "2022-02-09T02:46:31Z", "update_time" : "2022-02-09T02:46:31Z", "on_sell_status" : 2, "url_domains" : [ { "id" : "e91b83b07744e8eb1872d695ed4743b", "domain" : "domain.com", "cname_status" : 3, "ssl_id" : "ddsa83b07744e8eb1872d695ed4743b", "ssl_name" : "certificate", "min_ssl_version" : "TLSv1.1" } ] }, "func_info" : null, "mock_info" : null, "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" : "Application ID of the invoker.", "id" : "a1349c61016e4d999ca783a50bfeee2b" } ], "policy_functions" : null, "policy_mocks" : null, "policy_https" : [ ] } 示例 2 { "name" : "Api_function", "type" : 1, "version" : "V0.0.1", "req_protocol" : "HTTPS", "req_method" : "GET", "req_uri" : "/test/function", "auth_type" : "APP", "auth_opt" : { "auth_code_auth_type" : "DISABLE" }, "cors" : false, "match_mode" : "NORMAL", "backend_type" : "FUNCTION", "remark" : "FunctionGraph backend API", "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "body_remark" : "", "result_normal_sample" : "Normal response example", "result_failure_sample" : "Failure response example", "authorizer_id" : "", "tags" : [ "functionApi" ], "tag" : "", "roma_app_id" : "f77f5e81d9cb4424bf704ef2b0ac7690", "domain_name" : "www.sss.com", "id" : "abd9c4b2ff974888b0ba79be7e6b2763", "status" : 1, "arrange_necessary" : 2, "register_time" : "2020-08-02T15:56:52.286099413Z", "update_time" : "2020-08-02T15:56:52.286099715Z", "group_name" : "api_group_001", "group_version" : "V1", "run_env_name" : "", "run_env_id" : "", "publish_id" : "", "publish_time" : "", "roma_app_name" : "app-dfge", "ld_api_id" : "", "backend_api" : null, "api_group_info" : { "id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "name" : "api_group", "status" : 1, "sl_domain" : "c77f5e81d9cb4424bf704ef2b0ac7600.apic.****.com", "register_time" : "2020-08-02T15:56:52Z", "update_time" : "2020-08-02T15:56:52Z", "on_sell_status" : 2, "url_domains" : [ { "id" : "e91b83b07744e8eb1872d695ed4743b", "domain" : "domain.com", "cname_status" : 3, "ssl_id" : "ddsa83b07744e8eb1872d695ed4743b", "ssl_name" : "certificate", "min_ssl_version" : "TLSv1.1" } ] }, "mock_info" : null, "func_info" : { "id" : "c0740524cd4c40e3801a7afe5375f8b0", "authorizer_id" : "5b8cd3f06f004115aec69c58f57272c9", "function_urn" : "'urn:fss:region01:73d69ae0cfcf460190522d06b60f05ad:function:default:auto_testfunc93749'", "network_type" : "V1", "remark" : "", "invocation_type" : "sync", "timeout" : 5000, "version" : "latest", "alias_urn" : "urn:fss:region01:73d69ae0cfcf460190522d06b60f05ad:function:default:auto_testfunc93749:!a1", "register_time" : "2020-08-02T15:36:19.897262803Z", "update_time" : "2020-08-02T15:36:19.897262993Z", "status" : 1 }, "req_params" : [ ], "backend_params" : [ ], "policy_functions" : null, "policy_mocks" : [ ], "policy_https" : null } 示例 3 { "name" : "Api_mock", "type" : 1, "version" : "V0.0.1", "req_protocol" : "HTTPS", "req_method" : "GET", "req_uri" : "/test/mock", "auth_type" : "APP", "auth_opt" : { "auth_code_auth_type" : "DISABLE" }, "cors" : false, "match_mode" : "SWA", "backend_type" : "MOCK", "remark" : "Mock backend API", "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "body_remark" : "", "result_normal_sample" : "Normal response example", "result_failure_sample" : "Failure response example", "authorizer_id" : "", "tags" : [ "mockApi" ], "tag" : "", "roma_app_id" : "f77f5e81d9cb4424bf704ef2b0ac7690", "domain_name" : "www.sss.com", "id" : "3a955b791bd24b1c9cd94c745f8d1aad", "status" : 1, "arrange_necessary" : 2, "register_time" : "2020-08-02T15:56:52.286099413Z", "update_time" : "2020-08-02T15:56:52.286099715Z", "group_name" : "api_group_001", "group_version" : "V1", "run_env_name" : "", "run_env_id" : "", "publish_id" : "", "publish_time" : "", "roma_app_name" : "app-dfge", "ld_api_id" : "", "backend_api" : null, "api_group_info" : { "id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "name" : "api_group", "status" : 1, "sl_domain" : "c77f5e81d9cb4424bf704ef2b0ac7600.apic.****.com", "register_time" : "2020-08-02T15:56:52Z", "update_time" : "2020-08-02T15:56:52Z", "on_sell_status" : 2, "url_domains" : [ { "id" : "e91b83b07744e8eb1872d695ed4743b", "domain" : "domain.com", "cname_status" : 3, "ssl_id" : "ddsa83b07744e8eb1872d695ed4743b", "ssl_name" : "certificate", "min_ssl_version" : "TLSv1.1" } ] }, "mock_info" : { "remark" : "", "result_content" : "mock success", "version" : "m1", "authorizer_id" : "", "status_code" : 200, "header" : [ ], "id" : "e74bbc75825c4c38ae84ccab6bdc6175", "register_time" : "2020-08-02T15:56:52.301790367Z", "status" : 1, "update_time" : "2020-08-02T15:56:52.301790686Z" }, "func_info" : null, "req_params" : [ ], "backend_params" : [ ], "policy_functions" : null, "policy_mocks" : [ ], "policy_https" : null } 状态码: 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" }
  • 请求示例 创建一个API,认证方式为自定义认证,匹配方式为绝对匹配,后端类型为Web后端,并自定义前端请求参数和后端请求参数 { "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 response example", "result_failure_sample" : "Failure response example", "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" : "Application ID of the invoker." } ] } 创建一个API,认证方式为APP认证,匹配方式为绝对匹配,后端类型为 函数工作流 { "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'", "network_type" : "V1", "invocation_type" : "sync", "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" : "Normal response example", "result_failure_sample" : "Failure response example", "tags" : [ "functionApi" ] } 创建一个API,认证方式为APP认证,匹配方式为前缀匹配,后端类型为MOCK后端 { "group_id" : "c77f5e81d9cb4424bf704ef2b0ac7600", "match_mode" : "SWA", "name" : "Api_mock", "auth_type" : "APP", "backend_type" : "MOCK", "mock_info" : { "result_content" : "mock success" }, "req_protocol" : "HTTPS", "req_uri" : "/test/mock", "remark" : "Mock backend API", "type" : 1, "req_method" : "GET", "result_normal_sample" : "Normal response example", "result_failure_sample" : "Failure response example", "tags" : [ "mockApi" ] }
  • 获取 域名 云服务平台内业务系统访问API的场景,需获取内网域名作为独立域名。 申请内网域名,具体请参考创建内网域名。 配置域名到“服务集成APIC 连接地址”的A类型记录集配置,具体请参考增加A类型记录集。 如果API分组中的API支持HTTPS请求协议,则需要为独立域名添加SSL证书。您需要提前获取SSL证书的内容和密钥,并创建SSL证书。 云服务平台外业务系统访问API的场景,需获取公网域名作为独立域名。 申请公网域名,具体可通过 域名注册服务 申请。 备案公网域名,您可以通过备案中心完成域名备案。备案时长需几个工作日,建议您提前进行备案。 配置域名到API分组子域名的CNAME类型记录集配置,具体请参考增加CNAME类型记录集。 如果API分组中的API支持HTTPS请求协议,则需要为独立域名添加SSL证书。您需要提前获取SSL证书的内容和密钥,并创建SSL证书。
  • 约束与限制 独立域名绑定端口时,同一域名不支持绑定相同端口。 同一域名不同端口,无论哪个端口绑定/修改/解绑SSL证书、开启/关闭客户端认证,所有端口都会同步生效。 如果您通过负载通道访问后端服务,那么独立域名绑定的端口需与负载通道中后端服务器的访问端口保持一致。 独立域名绑定端口后,如果您通过IP地址访问API,那么需要在请求消息中添加Header参数“host”,host值必须带有对应的访问协议的端口(默认的80/443端口,host值可以不带)。
  • 注意事项 仅支持华为云 CCE Turbo 集群、VPC网络模型的CCE集群。 您需要确保当前实例与CCE集群所属同一个VPC中,或通过其他方式保证两者网络可达,否则导入后调用API会出现失败场景。 选择VPC网络模型的CCE集群时,您需要在实例详情界面的路由配置中添加CCE集群的容器网段,否则导入后调用API会出现失败场景。 导入后会生成相应的API以及微服务类型的负载通道,负载通道会监测工作负载下所有实例的地址变化,并更新到负载通道中。
  • 角色与操作权限说明 CodeArts API服务 各用户角色类型及对应的操作权限说明如下: 表1 通用设置默认角色权限说明 服务资源 权限 权限说明 项目管理员 项目经理 产品经理 测试经理 运维经理 系统工程师 Committer 开发人员 测试人员 参与者 浏览者 角色 权限设置 设置角色权限 Y Y N Y N N N N N N N 成员设置 设置项目成员 Y Y N Y N N N N N N N 项目 编辑 编辑项目信息 Y Y N Y Y N N Y Y N Y 表2 API测试默认角色权限说明 服务资源 权限 权限说明 项目管理员 项目经理 产品经理 测试经理 运维经理 系统工程师 Committer 开发人员 测试人员 参与者 浏览者 用例 创建 创建用例 Y Y Y Y N Y Y Y Y N N 查看 查看用例 Y Y Y Y Y Y Y Y Y Y Y 修改 修改用例 Y Y Y Y N Y Y Y Y N N 删除 删除用例 Y Y Y Y N Y Y Y Y N N 执行 执行用例 Y Y Y Y N Y Y Y Y N N 停止 停止用例 Y Y Y Y N Y Y Y Y N N 导出到文件 导出用例到文件 Y Y Y Y Y Y Y Y Y Y Y 从文件导入 从文件导入用例 Y Y Y Y N Y Y Y Y N N 从版本导入 从版本导入用例 Y Y Y Y N Y Y Y Y N N 合并到基线 合并到基线 Y Y N Y N Y Y N N N N 规范检查 规范检查 Y Y Y Y N Y Y Y Y N N 测试套 创建 创建测试套 Y Y Y Y N Y Y Y Y N N 查看 查看测试套 Y Y Y Y Y Y Y Y Y Y Y 修改 修改测试套 Y Y Y Y N Y Y Y Y N N 删除 删除测试套 Y Y Y Y N Y Y Y Y N N 执行 执行测试套 Y Y Y Y N Y Y Y Y N N 停止 停止测试套 Y Y Y Y N Y Y Y Y N N 测试版本 创建 创建测试版本 Y Y N Y N Y Y N N N N 查看 查看测试版本 Y Y Y Y Y Y Y Y Y Y Y 修改 修改测试版本 Y Y N Y N Y Y N N N N 删除 删除测试版本 Y Y N Y N Y Y N N N N 接口测试-关键字 创建 创建关键字 Y Y Y Y N Y Y Y Y N N 查看 查看关键字 Y Y Y Y Y Y Y Y Y Y Y 编辑 编辑关键字 Y Y Y Y N Y Y Y Y N N 删除 删除关键字 Y Y Y Y N Y Y Y Y N N 全局变量 创建 创建全局变量 Y Y Y Y N Y Y Y Y N N 查看 查看全局变量 Y Y Y Y Y Y Y Y Y Y Y 编辑 编辑全局变量 Y Y Y Y N Y Y Y Y N N 删除 删除全局变量 Y Y Y Y N Y Y Y Y N N 规则 创建 创建规则 Y Y Y Y N Y Y Y Y N N 查看 查看规则 Y Y Y Y Y Y Y Y Y Y Y 修改 修改规则 Y Y Y Y N Y Y Y Y N N 删除 删除规则 Y Y Y Y N Y Y Y Y N N 表3 项目资源默认角色权限说明 服务资源 权限 权限说明 项目管理员 项目经理 产品经理 测试经理 运维经理 系统工程师 Committer 开发人员 测试人员 参与者 浏览者 注册APIG 创建 注册API Y Y N N Y N N N N N N 查看 查看注册API Y Y Y Y Y Y Y Y Y Y Y 编辑 重新注册API Y Y N N Y N N N N N N 删除 删除注册API Y Y N N Y N N N N N N 版本控制 创建 版本管理页面新增版本按钮权限 Y Y N N N N N N N N N 查看 查看版本管理页面权限 Y Y Y Y Y Y Y Y Y Y Y 编辑 版本管理页面编辑按钮权限 Y Y N N N N N N N N N 删除 版本管理页面删除按钮权限 Y Y N N N N N N N N N 定时导入API 创建 创建定时导入任务 Y Y N N N N N N N N N 查看 查看定时导入任务 Y Y Y Y Y Y Y Y Y Y Y 编辑 编辑定时导入任务 Y Y N N N N N N N N N 删除 删除定时导入任务 Y Y N N N N N N N N N 执行 执行定时导入任务 Y Y N N N N N N N N N 父主题: 管理项目成员与角色权限
  • 响应示例 状态码: 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" }
  • 响应示例 状态码: 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" }
  • 响应示例 状态码: 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" : "GRP CS ", "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字段必须传入 枚举值: 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 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 is_send_fg_body_base64 Boolean 是否对与FunctionGraph交互场景的body进行Base64编码。仅当content_type为application/json时,可以不对body进行Base64编码。 应用场景: 自定义认证 绑定断路器插件,且断路器后端降级策略为函数后端 API后端类型为函数工作流 缺省值:true 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 url_domain String 后端服务的地址。 由主机(IP或域名)和端口号组成,总长度不超过255。格式为主机:端口(如:apig.example.com:7443)。如果不写端口,则HTTPS默认端口号为443,HTTP默认端口号为80。 支持环境变量,使用环境变量时,每个变量名的长度为3 ~ 32位的字符串,字符串由英文字母、数字、下划线、中划线组成,且只能以英文开头 req_protocol String 请求协议,后端类型为GRPC时请求协议可选GRPC、GRPCS 枚举值: HTTP HTTPS GRPC 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 ingress_http_port Integer 访问该域名绑定的http协议入方向端口,-1表示无端口且协议不支持,可使用80默认端口,其他有效端口允许的取值范围为1024~49151,需为实例已开放的HTTP协议的自定义入方向端口。 当创建域名时,该参数未填表示用默认80端口;若填写该参数,则必须同时填写https_port;若要http_port和https_port同时使用默认端口,则两个参数都不填。 当修改域名时,该参数未填表示不修改该端口。 最小值:-1 最大值:49151 ingress_https_port Integer 访问该域名绑定的https协议入方向端口,-1表示无端口且协议不支持,可使用443默认端口,其他有效端口允许的取值范围为1024~49151,需为实例已开放的HTTPS协议的自定义入方向端口。 当创建域名时,该参数未填表示用默认443端口;若填写该参数,则必须同时填写http_port;若要http_port和https_port同时使用默认端口,则两个参数都不填。 当修改域名时,该参数未填表示不修改该端口。 最小值:-1 最大值:49151 表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 COOKIE 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 orchestrations Array of strings 请求参数匹配编排规则的生效优先级与列表顺序保持一致,列表中靠前的配置匹配优先级较高; 如果编配规则列表中包含none_value类型的规则,则none_value类型的规则优先级最高,至多绑定一个none_value类型的规则; 如果编排规则列表中包含default类型的规则,则default类型的规则优先级最低,至多绑定一个default类型的规则; 当编排规则为预处理策略时,该规则不能作为除default以外的最后一个编排规则; 每个API仅允许选择一个参数绑定编排规则,且编排规则不能重复,支持绑定的编排规则数量有配额限制,具体请参见产品介绍的“配额说明”章节。 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、GRPC、GRPCS,后端类型为GRPC时可选GRPC、GRPCS 枚举值: HTTP HTTPS GRPC 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 策略值。 最大长度:1024 mapped_param_name String 参数编排规则编排后生成的参数名称,当condition_origin为orchestration的时候必填,并且生成的参数名称必须在api绑定的编排规则中存在 mapped_param_location String 参数编排规则编排后生成的参数所在的位置,当condition_origin为orchestration的时候必填,并且生成的参数所在的位置必须在api绑定的编排规则中存在 枚举值: header query 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 错误描述