Skip to main content

应用

整体说明

应用 API 可以使用组织的密钥或者应用级别密钥。

所有接口路径前缀都是 /openapi/company/{组织短名字}/app/{应用短名字}/,需要将路径中的短名字换成实际的值,比如 /openapi/company/50b55/app/6a814/

应用整体接口

获取应用下的所有资源

获取应用下的所有资源,用于外部系统控制AI速搭的权限分配。

地址:GET /openapi/company/{组织短名字}/app/{应用短名字}/resources

返回示例:

{
"status": 0,
"msg": "",
"data": {
"page": {
"name": "页面",
"items": [
{
"id": "k1Jw8ME8Gq",
"name": "页面名"
}
]
},
"dataModel": {
"name": "数据模型",
"items": [
{
"id": "M9QEWvywp8",
"name": "数据模型名"
}
]
},
"dataSource": {
"name": "数据源",
"items": [
{
"id": "k1Jw8ME8Gq",
"name": "数据源名"
}
]
},
"component": {
"name": "自定义组件",
"items": [
{
"id": "LM6wPMEJdb",
"name": "自定义组件名"
}
]
},
"APICenter": {
"name": "API",
"items": [
{
"id": "pezEbloLAB",
"name": "api名"
}
]
},
"APICenterGroup": {
"name": "API 分组",
"items": [
{
"id": "grOwVRwNXG",
"name": "分组名"
}
]
},
"role": {
"name": "角色",
"items": [
{
"id": "pezEbloLAB",
"name": "应用管理员"
}
]
}
}
}

获取应用下的对象存储资源列表

地址:GET /openapi/company/{组织短名字}/app/{应用短名字}/objectstorage

返回示例:

{
"status": 0,
"msg": "",
"data": {
"items": [
{
"id": "xxxx",
"appId": "0QkEDJPoyn",
"companyId": "k1Jw8ME8Gq",
"bucket": "xxxx",
"endpoint": "xxxx",
"region": "",
"filePathPattern": "{{date:YYYY-MM}}/{{md5}}{{ext}}",
"bigFilePathPattern": "{{date:YYYY-MM}}/{{name}}{{ext}}",
"fname": "md5",
"bfname": "name",
"s3ForcePathStyle": false,
"folder": "files",
"host": "",
"isDefault": true,
"key": "xxx",
"name": "测试",
"status": 1,
"type": "bos",
"createdAt": "2022-09-15T07:44:14.000Z",
"createdBy": "xxx"
}
],
"count": 1
}
}

角色相关接口

获取应用下的角色列表

地址:GET /openapi/company/{组织短名字}/app/{应用短名字}/role

返回示例:

{
"status": 0,
"msg": "",
"data": {
"items": [
{
"name": "应用管理员", // 角色名称,角色名称在一个应用内不可重名
"id": "pezEbloLAB", // 角色唯一 id
"description": "系统自动创建,应用级别角色,只在应用「nw」中可见。", // 描述新
"scope": "app", // 这是应用级别
"isBultin": true, // 是否是默认创建的
"editable": true, // 是否可编辑
"deleteable": true // 是否可删除
}
]
}
}

创建应用内角色

地址:Post /openapi/company/{组织短名字}/app/{应用短名字}/role

提交内容:{"name": "角色名"}

更新角色

地址:Post /openapi/company/{组织短名字}/app/{应用短名字}/role/${id}

提交内容:{"name": "角色名"}

删除角色

地址:Delete /openapi/company/{组织短名字}/app/{应用短名字}/role/{角色 id}

需要将角色 id 放到 url 中

获取角色中的用户列表

地址:Get /openapi/company/{组织短名字}/app/{应用短名字}/role/{角色 id}/member

返回示例:

{
"status": 0,
"msg": "",
"data": {
// 角色下包含的用户类别
"users": [
{
"nickName": "xxx", // 用户昵称
"email": "xxx@yyy.com", // 用户邮箱
"roleId": "l2pEKAo1Ry",
"id": "XdkEyJZMRp", // 用户 id
"removable": true
}
],
// 角色下包含的部门列表
"departments": [
{
"roleId": "l2pEKAo1Ry",
"id": "4MDE4xELmX", // 部门 id
"name": "部门名"
}
],
// 角色下包含的角色列表
"roles": [
{
"roleId": "l2pEKAo1Ry",
"id": "3Y4wzNwQ7P",
"name": "子角色名"
}
]
}
}

往角色中添加用户

用于给指定角色添加用户,支持通过 邮箱 或者 uid 添加用户,批量添加用 , 分隔。

地址:Post /openapi/company/{组织短名字}/app/{应用短名字}/role/{角色 id}/member/user

提交内容:{"email": "xxx@yyy.com", uid: "uid1,uid2"}

往角色中添加角色

地址:Post /openapi/company/{组织短名字}/app/{应用短名字}/role/{角色 id}/member/role

提交内容:{"role": " 角色 ID"}

获取子角色

地址:Get /openapi/company/{组织短名字}/app/{应用短名字}/role/{角色 id}/subRoles

提交内容:{"role": " 角色 ID"}

角色中移除成员

地址:Delete /openapi/company/{组织短名字}/app/{应用短名字}/role/{角色 id}/member/{成员 id}

角色中添加部门

地址:Post /openapi/company/{组织短名字}/app/{应用短名字}/role/{角色 id}/member/department

提交内容:{department : ["部门 id1", "部门 id2"]}

获取用户在某个应用中的角色

地址: Get /openapi/company/{组织短名字}/app/{应用短名字}/role/member/{用户ID}/roles

返回参数格式如下:

{
"status": 0,
"msg": "",
"data": {
"companyId": "k1Jw8ME8Gq",
"appId": "7dAE5Ko59n",
"userId": "k1Jw8ME8Gq",
"roles": [
{
"roleId": "lKVZOnEBdk", // 角色ID
"roleName": "MyApp-管理员" // 角色名称
},
{
"roleId": "dl6EgeojP1",
"roleName": "MyApp-用户"
}
]
}
}

权限相关接口

获取应用下有哪些 ACL 配置项

用于告知第三方AI速搭中有哪些可以配置的权限,比如页面可以配置「可见」、「可写」、「可删」这三项。

地址:Get /openapi/company/{组织短名字}/app/{应用短名字}/acl/options

返回示例:

{
"status": 0,
"msg": "",
"data": [
{
"name": "page",
"options": [
{
"name": "read",
"label": "可见"
},
{
"name": "write",
"label": "可写"
},
{
"name": "delete",
"label": "可删"
}
]
},
{
"name": "dataModel",
"options": [
{
"name": "read",
"label": "可见"
},
{
"name": "write",
"label": "可写"
},
{
"name": "delete",
"label": "可删"
}
]
},
{
"name": "dataSource",
"options": [
{
"name": "read",
"label": "可见"
},
{
"name": "write",
"label": "可写"
},
{
"name": "delete",
"label": "可删"
}
]
},
{
"name": "component",
"options": [
{
"name": "read",
"label": "可见"
},
{
"name": "write",
"label": "可写"
},
{
"name": "delete",
"label": "可删"
}
]
},
{
"name": "APICenter",
"options": [
{
"name": "read",
"label": "可见"
},
{
"name": "write",
"label": "可写"
},
{
"name": "delete",
"label": "可删"
},
{
"name": "call",
"label": "调用"
}
]
},
{
"name": "APICenterGroup",
"options": [
{
"name": "read",
"label": "可见"
},
{
"name": "write",
"label": "可写"
},
{
"name": "delete",
"label": "可删"
}
]
},
{
"name": "role",
"options": [
{
"name": "write",
"label": "可写"
},
{
"name": "delete",
"label": "可删"
}
]
}
]
}

获取某个角色应用运行时所拥有的资源权限

地址:Get /openapi/company/{组织短名字}/app/{应用短名字}/acl/runtime?env={环境类型}&roleName={角色名}

返回参数格式如下:

{
"status": 0,
"data": {
"readAcl": true,
"editAcl": true,
"dataManageAcl": true,
"viewLogAcl": true,
"resourceAcl": {
"pages": [
{
"id": "dl6EgeojP1",
"key": "home",
"title": "首页",
"acl": {"read": true}
}
]
}
}
}

设置某个角色所拥有的资源权限

地址:Post /openapi/company/{组织短名字}/app/{应用短名字}/acl/role?roleName={角色名}

提交内容示例,提交内容是数组,可以同时设置多个资源的权限:

[
{
"type": "APICenter", // 修改 api 中心的权限
"id": "LM6wPMEJdb", // 对应的 api id
"acl": {"read": true, "write": false, "call": true, "delete": false} // 权限详情,具体某个资源有哪些请参考前面接口返回的内容
},
{
"type": "page", // 修改某个页面的权限
"id": "dl6EgeojP1", // 对应的页面 id
"acl": "*" // 除了前面说到的方式,还可以使用 * 来方便设置这个资源的所有权限
}
]

获取某个应用可配置的权限点

地址: Get /openapi/company/{组织短名字}/app/{应用短名字}/acl

返回参数格式如下:

{
"status": 0,
"msg": "",
"data": {
"app": {
"key": "877f21d1cc5a",
"name": "XXX应用",
"subResources": [
{
"label": "应用访问",
"value": "read"
},
{
"label": "应用管理",
"value": "edit"
},
{
"label": "数据管理",
"value": "dataManage"
}
]
},
"page": {
"name": "页面",
"items": [
{
"id": "k1Jw8ME8Gq",
"name": "页面名",
"subResources": [
{
"label": "可打印",
"value": "print"
},
{
"label": "可导出",
"value": "export"
},
{
"label": "xxx接口可调用",
"value": "api.muEb9u9DdpbaGiFMhWqdjm.call"
}
],
"children": [
// 页面本身是树形结构的,所以用 tree 的格式返回
]
}
]
},
"dataModel": {
"name": "数据模型",
"items": [
{
"id": "M9QEWvywp8",
"name": "数据模型名"
}
]
},
"dataSource": {
"name": "数据源",
"items": [
{
"id": "k1Jw8ME8Gq",
"name": "数据源名"
}
]
},
"component": {
"name": "自定义组件",
"items": [
{
"id": "LM6wPMEJdb",
"name": "自定义组件名"
}
]
},
"APICenter": {
"name": "API",
"items": [
{
"id": "pezEbloLAB",
"name": "api名"
}
]
},
"APICenterGroup": {
"name": "API 分组",
"items": [
{
"id": "grOwVRwNXG",
"name": "分组名"
}
]
},
"role": {
"name": "角色",
"items": [
{
"id": "pezEbloLAB",
"name": "应用管理员"
}
]
}
}
}

获取某个应用运行态权限值

地址: Get /openapi/company/{组织短名字}/app/{应用短名字}/acl/runtime?env={环境类型}

返回参数格式如下:

{
"status": 0,
"data": {
"id": "3mrZq9ZjNR",
"readAcl": ["role:pezEbAOwLA", "role:yMJwpLmwpx"],
"editAcl": ["role:lKVZOXnoBd", "role:7dAE5Kro59"],
"dataManageAcl": ["role:lKVZOXnoBd", "role:7dAE5Kro59"],
"resourceAcl": {
"pages": [
{
"id": "8Yrw1RREK9",
"acl": {
"read": ["role:pezEbAOwLA"],
"owner": {
"write": true,
"delete": true
},
"3mrZq9ZjNR": {
"write": true,
"delete": true
},
"role:pezEbAOwLA": {
"read": true
}
},
"title": "首页",
"aclOptions": [{"label": "可读", "value": "read"}],
"children": [
{
"id": "3nywlG0ogX",
"acl": {
"read": ["role:pezEbAOwLA"],
"owner": {
"write": true,
"delete": true
},
"3mrZq9ZjNR": {
"write": true,
"delete": true
},
"role:pezEbAOwLA": {
"read": true
}
},
"title": "A",
"children": [],
"aclOptions": [
{"label": "可读", "value": "read"},
{
"label": "openapi测试",
"value": "api:atKvj7m4nSCc4GQHJUsW37:call"
}
]
}
]
}
]
}
}
}

设置某个应用运行态权限值

地址: post /openapi/company/{组织短名字}/app/{应用短名字}/runtime/acl?env={环境类型}

返回参数格式如下:

{
"id": "3mrZq9ZjNR",
"readAcl": ["role:LM6wPMEJdb"],
"editAcl": ["role:3mrZq9ZjNR", "role:Nq4omrw1g7"],
"dataManageAcl": ["role:3mrZq9ZjNR", "role:Nq4omrw1g7"],
"viewLogAcl": ["role:3mrZq9ZjNR", "role:Nq4omrw1g7"],
"resourceAcl": {
"pages": [
{
"id": "dl6EgeojP1",
"key": "home",
"title": "首页",
"children": [
{
"id": "lKVZOnEBdk",
"key": "test",
"title": "test",
"children": [],
"aclOptions": [
{"label": "可读", "value": "read"},
{
"label": "openapi测试",
"value": "api:atKvj7m4nSCc4GQHJUsW37:call"
}
],
"acl": {
"read": ["role:Nq4omrw1g7", "role:ygMwaloQAO"],
"owner": {"write": true, "delete": true},
"k1Jw8ME8Gq": {"write": true, "delete": true},
"role:Nq4omrw1g7": {
"read": true,
"api:atKvj7m4nSCc4GQHJUsW37:call": true
},
"role:ygMwaloQAO": {
"read": true,
"write": true,
"delete": true,
"api:atKvj7m4nSCc4GQHJUsW37:call": true
}
}
}
],
"aclOptions": [{"label": "可读", "value": "read"}],
"acl": {
"read": ["role:ygMwaloQAO", "role:Nq4omrw1g7"],
"owner": {"write": true, "delete": true},
"k1Jw8ME8Gq": {"write": true, "delete": true},
"role:Nq4omrw1g7": {"read": true},
"role:ygMwaloQAO": {"read": true, "write": true, "delete": true}
}
}
]
}
}

API 中心

调用 API 中心的接口

地址:

/openapi/company/{组织短名字}/app/{应用短名字}/page/{页面 id}/apicenterproxy/{api 的 key

需要有个页面 id,因为 api 在不同页面可能会有不同权限

git推送

地址: post /openapi/company/{组织短名字}/app/{应用短名字}/gitPush

提交内容

{
"gitEmail":"zhangsan@qq.com",
"gitUsername":"zhangsan",
"gitDesc":"git描述,可为空",
"repo":"git@github.com:z1769057083/dd.git",
"repoSrc":"存储目录,可为空",
"commit":"init",
"from":"dev",
"owner":"zhangsan@qq.com",
"branch":"main"
}

返回参数格式如下:

{
"status": 0,
"msg": "推送结果",
"data": {
"pushResult": "推送成功",
"stdout": "[main 1eb7333] init4\n 1 file changed, 1 insertion(+), 1 deletion(-)\n推送成功\n\nremote: Resolving deltas: 0% (0/2) \rremote: Resolving deltas: 50% (1/2) \rremote: Resolving deltas: 100% (2/2) \rremote: Resolving deltas: 100% (2/2), completed with 2 local objects. \nTo ssh://ssh.github.com:443/z1769057083/adada-..-4.git\n 53e2543..1eb7333 main -> main\n"
}
}

发布

发布应用

地址: post /openapi/company/{组织短名字}/app/{应用短名字}/release

提交内容

参数见控制台

返回参数格式如下:


{
"status":0,
"msg":"",
"data":{
"issues":[

],
"hasIssues":false
}
}

子应用推送参数初始化(小程序)

地址: Get /openapi/company/{组织短名字}/app/{应用短名字}/release/initPush

提交内容

{
"tag":"dev",
"from":"dev"
}

返回参数格式如下:


{
"status": 0,
"msg": "",
"data": {
"version": "1.0.0",
"readAcl": [],
"editAcl": [],
"dataManageAcl": [],
"flowManageAcl": [],
"adminRoleAcl": [],
"createRoleAcl": [],
"viewLogAcl": [],
"resourceAcl": {},
"templates": [],
"rolesOptions": [],
"rolesRelation": [],
"partialOptions": [],
"jssdkOptions": [],
"wildcardRoleId": "role:1",
"appGuestRoleId": "role:421",
"tagOptions": [
{
"label": "测试环境",
"value": "qa"
},
{
"label": "沙盒环境",
"value": "sandbox"
},
{
"label": "正式环境",
"value": "latest"
}
],
"consts": [],
"languagesOptions": [
{
"label": "简体中文",
"value": "zh-CN",
"disabled": true
}
],
"fromOptions": [
{
"label": "当前开发环境",
"value": "dev"
}
],
"languages": "zh-CN",
"appEntries": []
}
}

子应用推送(小程序)

地址: post /openapi/company/{组织短名字}/app/{应用短名字}/release/ciPush

提交内容

参数见控制台

返回参数格式如下:


{
"status":0,
"msg":"推送任务发起成功,请查看推送历史查看进度详情"
}

发布记录列表

地址: Get /openapi/company/{组织短名字}/app/{应用短名字}/release

提交内容

{
"page": 1,
"perPage": 10
}

返回参数格式如下:


{
"status": 0,
"msg": "",
"data": {
"items": [
{
"id": "7dAE5QbE59",
"title": "111",
"version": "1.0.0-beta.12",
"tag": "qa",
"createdAt": "2023-07-24T09:08:16.000Z",
"createdBy": "zhangsan",
"accessUrl": "/ffa3bc393fb3",
"dropDownEntries": [
{
"type": "button",
"label": "ls_mobile",
"actionType": "link",
"link": "/ffa3bc393fb3",
"blank": true
}
],
"status": 2,
"config": {
"exportAllImages": false
},
"taskId": "4DNoR1MZ3l"
},
...
],
"count": 13
}
}

重要参数说明

status -1 发布失败、0 已过期、1 正在使用、2 发布中

发布记录详情

地址: Get /openapi/company/{组织短名字}/app/{应用短名字}/release/:id

返回参数格式如下:


{
"task": {
"log": "[INFO][2023-07-24 17:08:16.929] 任务初始化中...\n"
}
}

子应用推送记录(小程序)

地址: Get /openapi/company/{组织短名字}/app/{应用短名字}/release/ciPushList

提交内容

{
"page": 1,
"perPage": 10
}

返回参数格式如下:


{
"status": 0,
"msg": "",
"data": {
"items": [
{
"id": "4DNoRYdZ3l",
"id1": "4DNoRYdZ3l",
"title": "111",
"version": "1.0.0-beta.18",
"tag": "qa",
"createdAt": "2023-07-21T06:52:48.000Z",
"createdBy": "zhangxulong",
"accessUrl": "/company/44ba5/app/24a4c13c72f4-qa/a02ad379b4ab",
"status": 1,
"taskId": "xMdZG1Ww58",
"appletType": 0
},
...
],
"count": 62
}
}

重要参数说明

status -1 发布失败、0 已过期、1 正在使用、2 发布中

appletType 小程序类型 0 微信小程序 1 百度小程序swan 2 支付宝小程序 3 抖音小程序

子应用推送详情(小程序)

地址: Get /openapi/company/{组织短名字}/app/{应用短名字}/release/pushDetail

提交内容

{
"id": "O7zENAGwMa"
}

返回参数格式如下:


{
"consts": [],
"task": {
"log": "[INFO][2023-07-21 14:52:48.052] 任务初始化中...\n"
}
}