全部文档
当前文档

暂无内容

如果没有找到您期望的内容,请尝试其他搜索词

文档中心

创建API

最近更新时间:2020-08-21 11:17:43

创建API(AddApi)

描述

创建API

HTTP METHOD

GET | POST

请求参数

公共参数列表 详情

名称 类型 必填 长度限制(字符) 参数格式 描述
Action String 确定值 [a-zA-Z]+ 操作接口名,系统规定参数,取值: AddApi
Version String 确定值 固定为:2019-05-01
ApiName String 3-64个字符 API名称
ApiDesc String 255字符内 API描述
ApiGroupUuid String 22个字符 [a-zA-Z0-9-_]+ 所属组UUID
FrontAuthType Integer 类型 1-公开 2-私有
BackendAuthType Integer 安全认证类型 1-APP认证 2-金山云IAM认证 3-无认证
FrontReqType Integer 请求协议 1-HTTP 2-HTTPS 3-包含两者
BackendServiceType Integer 后端请求类型 1-HTTP(S) 2-Mock 3-vpc通道
ApiBaseInfo String json串 Api信息
ApiReqInfo String json串 Api请求信息
ApiBackendInfo String json串 后端请求信息
ApiRespInfo String json串 响应信息
返回结果

通过指定 Accept:application/json,返回的数据格式为json

示例(调用成功)
请求示例
curl -X GET|POST \
'http://apigw.api.ksyun.com/?Action=AddApi&Version=2019-05-01&ApiName=Ksyun&Type=1&ApiDesc=Ksyun+Desc&ApiGroupUuid=e799f912300ce953d11ccdd107305e2f&FrontAuthType=1&BackendAuthType=1&FrontReqType=3&BackendServiceType=1&ApiBaseInfo=%7B%22api_name%22%3A%22Ksyun%22%2C%22api_desc%22%3A%22Ksyun+Desc%22%2C%22api_group_uuid%22%3A%22e799f912300ce953d11ccdd107305e2f%22%2C%22type%22%3A1%2C%22front_auth_type%22%3A1%2C%22backend_auth_type%22%3A1%2C%22front_req_type%22%3A3%2C%22backend_service_type%22%3A1%7D&ApiReqInfo=%7B%22domain%22%3A%22e799f912300ce953d11ccdd107305e2f.cn-beijing-6.kscloudapi.com%22%2C%22req_protocol%22%3A3%2C%22req_uri%22%3A%22%5C%2Finfo%22%2C%22path_match_mode%22%3A1%2C%22req_method%22%3A%22GET%22%2C%22is_cors%22%3A0%2C%22req_params%22%3A%5B%5D%2C%22is_not_w_form%22%3A0%2C%22content%22%3A%22%22%2C%22model_uuid%22%3Anull%7D&ApiBackendInfo=%7B%22req_protocol%22%3A%22http%22%2C%22service_type%22%3A1%2C%22const_params%22%3A%5B%5D%2C%22sys_params%22%3A%5B%5D%2C%22backend_params%22%3A%5B%5D%2C%22req_address%22%3A%22test.com%22%2C%22address_type%22%3A1%2C%22req_path%22%3A%22%5C%2FgetUserInfo%22%2C%22req_method%22%3A%22GET%22%2C%22backend_auth_type%22%3A1%2C%22connect_timeout%22%3A%221000%22%2C%22read_timeout%22%3A%223000%22%7D&ApiRespInfo=%7B%22success%22%3A%22%7B%5Cn%7D%22%2C%22failed%22%3A%22%7B%5Cn%7D%22%2C%22error_code%22%3A%5B%5D%7D' \
-H 'authorization: xxx, SignedHeaders=accept;content-type;host;x-amz-date, Signature=xxx' \
-H 'accept: application/json' \
-H 'content-type: application/x-www-form-urlencoded' \
-H 'host: apigw.api.ksyun.com' \
-H 'x-amz-date: 20170720T022802Z'
响应成功返回示例
{
    "Res": [],
    "RequestId": "7de19b5e-0791-4269-872b-c3e05b53c3c8"
}

访问API错误码查看更多错误码

文档导读
纯净模式常规模式

纯净模式

点击可全屏预览文档内容
文档反馈