该接口用于配置API服务,实现物平台的服务调用能力。通常还需要配置页面集成,需要自己配置appid/secureKey。
配置API服务后,系统将自动创建对应的“第三方应用”用户。用户的账号/密码分别对应appid/secureKey。
第三方用户可调用的API服务在其应用管理卡片的”其他 > 赋权“页面,进行自定义配置。
请求接口
POST /api/application
请求参数
| 名称 | 位置 | 类型 | 必选 | 说明 |
|---|---|---|---|---|
| X-Access-Token | header | string | true | 平台token |
| body | body | object | true | - |
| » id | body | string | true | ID |
| » name | body | string | true | 名称 |
| » description | body | string | false | 说明 |
| » name | body | string | true | 名称 |
| » provider | body | string | true | 应用类型 |
| » integrationModes | body | array | true | 接入方式,填入apiServer |
| » apiServer | body | object | true | - |
| »» appId | body | string | true | App ID,自定义 |
| »» secureKey | body | string | true | 密钥Key |
| »» roleIdList | body | array | true | 角色 调用角色列表接口,获取角色ID,赋予API服务相应角色。 |
| »» orgIdList | body | array | false | 组织 调用组织列表接口,获取组织ID,赋予API服务相应组织。 |
| »» redirectUri | body | string | false | 回调地址 |
响应参数
以200 Response为例,响应参数如下:
| 名称 | 类型 | 必选 | 约束 | 说明 |
|---|---|---|---|---|
| » message | string | true | none | 消息提示 |
| » result | object | true | none | 数据内容 |
| »» id | st ring | true | none | ID |
| »» name | string | true | none | 用户名 |
| »» provider | string | true | none | 接入方式 |
| »» description | string | true | none | 说明 |
| »» integrationModes | [object] | true | none | 集成模式 |
| »»» text | string | true | none | 集成模式名称 |
| »»» value | string | true | none | 集成模式标识 |
| »» apiServer | object | true | none | - |
| »»» secureKey | object | true | none | 密钥Key |
| »»» signature | string | true | none | 签名 |
| »»» roleIdList | array | true | none | 角色 |
| »»» orgIdList | array | true | none | 组织 |
| »» state | object | true | none | 状态 |
| »»» text | string | true | none | 状态名称 |
| »»» value | string | true | none | 状态标识 |
| »» creatorId | string | true | none | 创建者ID |
| »» createTime | integer | true | none | 创建时间 |
| » status | integer | true | none | 响应状态码 |
| » timestamp | integer | true | none | 时间戳 |
响应状态码
| 状态码 | 状态码含义 | 说明 |
|---|---|---|
| 200 | OK | 成功 |
| 401 | Unauthorized | 登录状态已过期,token不能为空 |
| 500 | Internal Server Error | 服务器内部异常 |
Body示例
json
{
"provider":"internal-standalone",
"integrationModes":["apiServer"],
"apiServer":{
"appId":"ykjCyWAG5MDnTmFY",
"secureKey":"BkPZhjK36Zb8M2KRpKdAM2krCDCNNdYZ",
"roleIdList":["1589807922792402944"],
"orgIdList":["1595617360684232704"]
},
"name":"API服务-测试",
"description":"1",
"id":"ykjCyWAG5MDnTmFY"
}{
"provider":"internal-standalone",
"integrationModes":["apiServer"],
"apiServer":{
"appId":"ykjCyWAG5MDnTmFY",
"secureKey":"BkPZhjK36Zb8M2KRpKdAM2krCDCNNdYZ",
"roleIdList":["1589807922792402944"],
"orgIdList":["1595617360684232704"]
},
"name":"API服务-测试",
"description":"1",
"id":"ykjCyWAG5MDnTmFY"
}返回示例
json
{
"message": "success",
"result": {
"id": "ykjCyWAG5MDnTmFY",
"provider": "internal-standalone",
"name": "API服务-测试",
"description": "1",
"integrationModes": [
{
"text": "API服务",
"value": "apiServer"
}
],
"apiServer": {
"secureKey": "BkPZhjK36Zb8M2KRpKdAM2krCDCNNdYZ",
"signature": "MD5",
"roleIdList": [
"1589807922792402944"
],
"orgIdList": [
"1595617360684232704"
]
},
"state": {
"text": "启用",
"value": "enabled"
},
"creatorId": "1199596756811550720",
"createTime": 1693451400166
},
"status": 200,
"timestamp": 1693451400517
}{
"message": "success",
"result": {
"id": "ykjCyWAG5MDnTmFY",
"provider": "internal-standalone",
"name": "API服务-测试",
"description": "1",
"integrationModes": [
{
"text": "API服务",
"value": "apiServer"
}
],
"apiServer": {
"secureKey": "BkPZhjK36Zb8M2KRpKdAM2krCDCNNdYZ",
"signature": "MD5",
"roleIdList": [
"1589807922792402944"
],
"orgIdList": [
"1595617360684232704"
]
},
"state": {
"text": "启用",
"value": "enabled"
},
"creatorId": "1199596756811550720",
"createTime": 1693451400166
},
"status": 200,
"timestamp": 1693451400517
}