文件
查询文件列表
1.接口说明
接口路径:/efile/openapi/v2/file/list
请求方式:GET
请求数据类型:
接口描述:查询文件列表
2.请求消息
请求参数:
Headers:
| 名称 | 类型 | 必填 | 描述 | 示例 |
|---|---|---|---|---|
| token | string | 是 | 接口凭证 | eyJhbGciOiJIUzI1... |
参数:
| 名称 | 类型 | 必填 | 描述 | 示例 |
|---|---|---|---|---|
| limit | long | 是 | 每页要显示的大小,默认为10 | 100 |
| order | string | 否 | 参数值:asc:顺序;desc:倒序 | asc |
| orderBy | string | 否 | name:文件名(默认);size:文件大小;lastModifiedTime:文件修改时间 | name |
| path | string | 否 | 目标文件夹路径,参数不存在时:默认为用户家目录,存在时:以具体参数为准(必须为绝对路径) | /public/home/test/BASE |
| start | long | 是 | 起始索引位置,默认为0 | 0 |
| keyWord | string | 否 | 搜索关键字 | test、文件夹名称 |
3.请求示例
cURL请求示例
shell
curl --location 'https://scnet-demo.accloud.cn/efile/openapi/v2/file/list?limit=20&order=asc&orderBy=name&start=0' \
--header 'Content-Type: application/json' \
--header 'token: <Token>'Java请求示例
java
import okhttp3.*;
public class getFileListDemo {
public static final String TOKEN = "<Token>";
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://scnet-demo.accloud.cn/efile/openapi/v2/file/list?limit=20&order=asc&orderBy=name&start=0")
.method("GET", null)
.addHeader("Content-Type", "application/json")
.addHeader("token", TOKEN)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}Python请求示例
python
import requests
import json
url = "https://scnet-demo.accloud.cn/efile/openapi/v2/file/list?limit=20&order=asc&orderBy=name&start=0"
payload = {}
headers = {
"Content-Type": "application/json",
"token": "<Token>"
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)4.响应消息
返回参数:
| 名称 | 类型 | 描述 | 示例 |
|---|---|---|---|
| msg | string | 信息 | 操作成功 |
| code | string | 状态码 | 0 |
| data | object | ||
| children | object | 子节点目录 | |
| id | string | 文件id | 769921355 |
| label | string | 文件名称 | 00-HPC-CASE |
| path | string | 文件路径 | /public/home/test/00-HPC-CASE |
| fileList | array | 文件列表 | |
| creationTime | string | 创建时间 | 2021-09-06 15:02:57 |
| fileKey | string | file标识 (备用) | -1727366384 |
| group | string | 分组信息 | test |
| isDirectory | boolean | 是否文件夹 | true |
| isShare | boolean | 是否分享 | false |
| isSymbolicLink | boolean | 是否链接文件 | false |
| lastAccessTime | string | 最后一次访问时间 | 2021-09-06 15:02:46 |
| lastModifiedTime | string | 最后一次修改时间 | 2021-09-06 15:02:57 |
| name | string | 文件名 | 00-HPC-CASE |
| owner | map | 文件所有人 | test |
| path | string | 文件路径 | /public/home/test/00-HPC-CASE |
| permission | string | 文件权限字符串 | rwxrw-r-- |
| permissionAction | object | ||
| allowed | boolean | 当前用户允许重命名删除操作 | true |
| execute | boolean | 当前用户可执行 | true |
| read | boolean | 当前用户可读 | true |
| write | boolean | 当前用户可写 | true |
| size | long | 文件大小 | 8192 |
| isOther | boolean | 是否其他 | true |
| isRegularFile | boolean | 是否正则文件 | true |
| type | string | 类型 | |
| shareEnabled | boolean | 分享开关 | true |
| total | long | 会话所有总条数者 | 40 |
| path | string | 文件夹路径 | /public/public/home/test |
| keyword | string | 搜索关键词 | 40 |
返回示例:
json
{
"code":"0",
"data":{
"total":1,
"fileList":[
{
"owner":"test",
"lastAccessTime":"2021-12-10 11:44:35",
"lastModifiedTime":"2021-12-10 16:11:30",
"creationTime":"2021-12-10 16:11:30",
"isRegularFile":false,
"permission":"rwxrwxr-x",
"fileKey":2137452981,
"type":"",
"path":"/public/home/test/BASE/STDIN_1210_114429",
"size":4096,
"isSymbolicLink":false,
"name":"STDIN_1210_114429",
"isShare":false,
"permissionAction":{
"read":true,
"allowed":true,
"write":true,
"execute":true
},
"isOther":false,
"isDirectory":true,
"group":"test"
}
],
"children":[
{
"path":"/public/home/test/BASE/STDIN_1210_114429",
"id":2137452981,
"label":"STDIN_1210_114429"
}
],
"path":"/public/home/test/BASE",
"keyWord":null,
"shareEnabled":false
},
"msg":"success"
}5.错误码
| 错误码 | 说明 |
|---|---|
| 0 | 成功 |
| 10001 | 内部异常(其他异常) |
| 10003 | 参数不全 |
| 10004 | 参数无效 |
| 10009 | 不支持的版本 |
| 911009 | 区域用户不存在 |
| 911020 | 文件不存在 |
| 911021 | 文件已存在 |
| 911022 | 目标地址不是一个文件夹 |
| 911025 | 分享文件已存在,请重命名后分享 |
| 911029 | 文件路径包含特殊字符,请重命名后再操作 |
| 911030 | 权限不足,禁止操作 |
| 911031 | 文件重命名失败 |
| 911034 | 分享链接创建失败,请重新分享 |
| 911404 | ac认证服务端连接异常 |
| 911406 | 服务端token认证异常,未取到关联用户 |
| 911501 | 存储空间不足 |
| 911502 | 目录非空,操作失败 |
| 911504 | 命令执行超时 |
| 911505 | 文件大小超出预设大小,无法预览 |
| 911506 | 文件类型不在预设范围内,不允许打开 |
| 911507 | 源文件与目标文件一致,禁止操作 |
| 911700 | 文件名包含非法字符,请重命名后再操作 |