主题
接口注册
接口说明
请求URL:http[s]://{网关地址}/minos-gateway/api/register
请求方式: POST
请求内容类型: application/json
响应内容类型: application/json
请求说明
请求体
| 字段名 | 参数名 | 必填 | 类型 | 描述 |
|---|---|---|---|---|
| 接口名称 | apiName | M | String | 接口名称 |
| 代理地址 | agentPath | M | String | 发布地址(不重复,唯一) |
| 真实地址 | realPath | M | String | 提供方地址 |
| 接口分组名称 | classifyName | O | String | 可填写平台已有的接口分组名称; 当填写的分组名称不存在时,默认新建一个分组;不填则放在未分配 |
| 请求方式 | reqMethod | O | String | 请求方式 GET POST(默认) |
| 后端请求方式 | agentRequestType | O | String | 请求方式 GET POST(默认) |
| 说明 | desc | O | String | 说明 |
| 鉴权详细名称 | authName | O | String | 当鉴权名称为空,则默认使用apiName做为鉴权名称; 当鉴权名称已经存在,再使用已有鉴权,若不存在,则通过鉴权信息列表authentication创建 |
| 鉴权信息列表 | authentications | O | List<Auth> | 鉴权信息列表 |
| 字段名 | 参数名 | 必填 | 类型 | 描述 |
|---|---|---|---|---|
| 鉴权信息key | headerKey | M | String | 接口鉴权信息key |
| 鉴权信息value | headerValue | M | String | 接口鉴权信息value |
请求示例
json
{
"apiName":"newApiName",
"agentPath":"/wisedu/api/01",
"realPath":"http://wisedu.server.com/wisedu/api/path/01",
"classifyName":"oneClassify",
"reqMethod":"GET",
"agentRequestType":"GET",
"desc":"api desc",
"authName":"authExample",
"authentications":[
{"headerKey":"keyOne","headerValue":"value1"},
{"headerKey":"keyTwo","headerValue":"value2"}
]
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
响应说明
响应体
| 字段名 | 必填 | 类型 | 描述 |
|---|---|---|---|
| errcode | 是 | String | 返回码,0 成功 |
| errmsg | 否 | String | 返回码描述 |
| data | 否 | Object | 返回的对象的json串 |
响应示例
json
{
"errcode": "0",
"errmsg": "success",
"data": "接口注册成功"
}1
2
3
4
5
2
3
4
5
错误码
| 错误码 | 描述 |
|---|---|
| 999 | 统一错误码,详细描述信息参见接口返回 |
Demo
java
// 创建客户端
Client client = new DefaultClient(BASE_URL, APP_ID, APP_SECRET);
// 创建请求对象
RegisterApiRequest request = new RegisterApiRequest();
request.setApiName("newApiName001");
request.setAgentPath("/wisedu/api/001");
request.setRealPath("http://wisedu.server.com/wisedu/api/path/001");
List<AuthInfo> authentications = new ArrayList<>();
authentications.add(new AuthInfo("keyOne","value1"));
authentications.add(new AuthInfo("keyTwo","value2"));
request.setAuthentications(authentications);
BaseResponse response = client.execute(request);
//调用成功,则处理业务逻辑
if (response.isSuccess()) {
//.....
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

