API网关 APIG-创建API:响应示例

时间:2025-01-26 10:51:02

响应示例

状态码: 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"}
support.huaweicloud.com/api-apig/CreateApiV2.html