结构化内容插入[文件执行指令]
适用版本>=v7.0.2512.20251225
接口说明:结构化内容插入[文件执行指令]
请求说明
| 请求地址 | 配置域名+/openapi+/v7/appfiles/drives/{drive_id}/files/{file_id}/exec_script |
|---|---|
| 请求方法 | POST |
| 签名方式 | KSO-1(配置域名+/openapi不参与签名) |
| 权限要求 | 应用身份管理文档(应用授权) kso.appfiles.exec_script.readwrite |
请求头(Header)
| Header | 参数类型 | 是否必填 | 说明 |
|---|---|---|---|
| X-Kso-Date | string | 是 | RFC1123 格式的日期,例: Wed, 23 Jan 2013 06:43:08 GMT |
| X-Kso-Authorization | string | 是 | KSO-1 签名值,详见《签名方法》 |
| Authorization | string | 是 | 授权凭证,格式为:Bearer {access_token} |
路径参数(Path)
| 名称 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| drive_id | string | 是 | 驱动盘id |
| file_id | string | 是 | 文件id |
查询参数(Query)
| 名称 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| _w_third_user_id | string | 否 | 操作者id |
请求体(Body)
| 字段名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| script | string | 是 | 指令脚本 |
| password | string | 否 | 文档密码,不为空时,会参与转换PDF的过程,加密方式:先进行AES/ECB/PKCS5Padding加密,再进行base64加密 |
| overwrite | boolean | 否 | 指令为修改文档时,若为true则覆盖原文件生成新版本,为false则保存到新文件,默认为true |
请求体示例
json
{
"script": "string",
"password": "admin@123",
"overwrite": true
}响应体(Response)
| 名称 | 类型 | 说明 |
|---|---|---|
| data | object | 返回的数据对象 |
| ∟ file_info | object | 文件信息对象 |
| ∟∟ id | string | 文件 ID |
| ∟∟ name | string | 文件名称 |
| ∟∟ type | string | 文件类型 Enum: "folder" "file" |
| ∟∟ parent_id | string | 父目录 ID(应用文档固定为 "0") |
| ∟∟ size | integer | 文件大小(字节) |
| ∟∟ version | integer | 文件版本号 |
| ∟∟ drive_id | string | 驱动盘 ID |
| ∟∟ ctime | integer | 创建时间(Unix 时间戳) |
| ∟∟ mtime | integer | 修改时间(Unix 时间戳) |
| ∟∟ shared | boolean | 是否分享(应用文档为 false) |
| ∟∟ link_id | string | 链接 ID(应用文档为空字符串) |
| ∟∟ link_url | string | 链接 URL(应用文档为空字符串) |
| ∟∟ created_by | object | 创建者信息 |
| ∟∟∟ id | string | 身份 ID |
| ∟∟∟ type | string | Enum: "sp" |
| ∟∟ modified_by | object | 修改者信息 |
| ∟∟∟ id | string | 身份 ID |
| ∟∟∟ type | string | Enum: "sp" |
| ∟ exec_result | string | 脚本执行结果输出 |
| code | int | 错误码 |
| msg | string | 状态信息 |
| detail | string | 详细信息 |
响应体示例
json
{
"data": {
"file_info": {
"id": "350750123212800",
"drive_id": "349087249465344",
"parent_id": "0",
"created_by": {
"id": "userID",
"type": "sp"
},
"modified_by": {
"id": "userID",
"type": "sp"
},
"size": 20480,
"version": 3,
"type": "file",
"name": "脚本处理结果文档.docx",
"ctime": 1764931200,
"mtime": 1764931200,
"shared": false,
"link_url": "",
"link_id": ""
},
"exec_result": "Script executed successfully."
},
"code": 0,
"msg": "ok",
"detail": ""
}