文件

移动文件

1.接口说明

接口路径:/efile/openapi/v2/file/move

请求方式:POST

请求数据类型:application/x-www-from-urlencoded

接口描述:移动文件(文件大小越大、数量越多,接口耗时会相应的更久)

2.请求消息

请求参数:

Headers:

名称 类型 必填 描述 示例
tokenstring接口凭证eyJhbGciOiJIUzI1N...

参数:

名称 类型 必填 描述 示例
sourcePathsstring源文件绝对路径,支持批量。多文件全路径之间用英文逗号分隔/home/demo/efile-test/test1.txt,/home/demo/efile-test/test.txt2
coverstring参数值:cover:强制覆盖,uncover:不覆盖,默认:uncoveruncover
targetPathstring目标目录绝对路径/home/demo/efile-test

3.请求示例

cURL请求示例

curl --location 'https://api01.xxx.com:65103/efile/openapi/v2/file/move' \
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJPd2UiLCJjcmVhdG9yIjoiYWMiLCJlbmRwb2ludCI6IjAxIiwicm9sZSI6IjEiLCJleHBpcmVUaW1lIjoiMTY5OTE2NDYxNzAzMyIsImNsdXN0ZXJJZCI6IjExMjUwIiwiaW52b2tlciI6InNhY3AiLCJ1c2VyIjoic2x1cm10ZXN0IiwidXNlcklkIjoiMTI5MDcwMDk3MDEifQ.bxro-OYGjjpBDSD_lUiXzBdt6QggMniZDTnAm98O7ZQ' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'sourcePaths=/home/demo/efile-test/test1.txt,/home/demo/efile-test/test.txt2' \
--data-urlencode 'cover=uncover' \
--data-urlencode 'targetPath=/home/demo/efile-test'

Java请求示例

import okhttp3.*;

public class FileMoveDemo {

    public static final String TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJUcmlhbCIsImNyZWF0b3IiOiJhYyIsInJvbGUiOiIxIiwiZXhwaXJlVGltZSI6IjE2ODY5MDg1MDkyMzEiLCJjbHVzdGVySWQiOiIxMTExMiIsImludm9rZXIiOiI2MDQ4Y2U3YmExNWMyYWYyZThjZWMxMjk5MWVjMTNjZiIsInVzZXIiOiJzbHVybXRlc3QiLCJ1c2VySWQiOiIxMTY1NTA0ODU0MSJ9.U7pZKgO_K6NuRwOWPxblDfgRpGeVxS-BYieOdLhGDK4";
    public static final String URL = "https://api01.xxx.com:65103/efile/openapi/v2/file/move";

    public static void main(String[] args) throws Exception {
        OkHttpClient client = new OkHttpClient().newBuilder()
            .build();
        MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
        RequestBody body = RequestBody.create(mediaType, "sourcePaths=/home/demo/efile-test/test1.txt,/home/demo/efile-test/test.txt2&cover=uncover&targetPath=/home/demo/efile-test");
        Request request = new Request.Builder()
                .url(URL)
                .method("POST", body)
                .addHeader("token", TOKEN)
                .addHeader("Content-Type", "application/x-www-form-urlencoded")
                .build();
        Response response = client.newCall(request).execute();
        System.out.println(response.body().string());
    }
}

Python请求示例

import requests

url = "https://api01.xxx.com:65103/efile/openapi/v2/file/move"

payload = 'sourcePaths=%2Fhome%2Fdemo%2Fefile-test%2Ftest1.txt%2C%2Fhome%2Fdemo%2Fefile-test%2Ftest.txt2&cover=uncover&targetPath=%2Fhome%2Fdemo%2Fefile-test'
headers = {
  'token': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb21wdXRlVXNlciI6InNsdXJtdGVzdCIsImFjY291bnRTdGF0dXMiOiJPd2UiLCJjcmVhdG9yIjoiYWMiLCJlbmRwb2ludCI6IjAxIiwicm9sZSI6IjEiLCJleHBpcmVUaW1lIjoiMTY5OTE2NDYxNzAzMyIsImNsdXN0ZXJJZCI6IjExMjUwIiwiaW52b2tlciI6InNhY3AiLCJ1c2VyIjoic2x1cm10ZXN0IiwidXNlcklkIjoiMTI5MDcwMDk3MDEifQ.bxro-OYGjjpBDSD_lUiXzBdt6QggMniZDTnAm98O7ZQ',
  'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

4.响应消息

返回参数:

名称 类型 说明
msgstring异常时的详细异常信息
codestring0:成功,10003:参数异常,911020:文件不存在,911021:文件已存在,911501:空间不足,911507:源文件与目标文件一致,禁止操作,911009:区域用户不存在,911030:权限不足,10001:其它异常
dataobject

返回示例:

{
  "code": "0",
  "data": null,
  "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 文件名包含非法字符,请重命名后再操作

results matching ""

    No results matching ""