亿方云开放平台API文档 (2.0)

Download OpenAPI specification:Download

开放平台相关密钥请联系亿方云工作人员。

开放平台新手入门教程

开放平台简介


亿方云开放平台是基于亿方云基础业务和功能向开发者提供二次开发的服务平台,为企业提供丰富的云盘文档协同管理解决方案。企业或第三方合作伙伴可以快速低成本地接入亿方云,实现存储、查看、分享、协作等一站式文件管理。激活企业非结构数据资产价值,助你的企业更快一步。

亿方云开放平台提供UI组件、SDK、API等接入方式,10行代码助你构建企业文件统一管理平台。

kaifangpingtaijianjie

平台架构


亿方云的开放平台,是在云计算背景下,将亿方云已有的能力通过多种形式开放给第三方开发者使用,而产生的一种技术能力输出。开放平台所有功能基于亿方云已有功能,并不断迭代,基于安全角度考虑,所有能力输出将严格依照Oauth2协议进行授权和鉴权。

其中核心能力为接入层的代理服务、Oauth鉴权服务、Open API能力输出。代理服务主要提供访问接入底层服务,以WEB方式实现。Oauth鉴权服务通过Oauth协议对接入者进行授权和鉴权,返回相应的access_token信息,该token具备时效性,可有效保障接入安全和数据安全。Open API即为亿方云能力输出相关API,目前已开放近100个API,涉及文件(夹)管理、分享、协作、日志、消息、第三方同步等大量功能,可有效辅助开发者接入开放平台。

在此基础上,为便于开发者接入亿方云开放平台,还提供了WEB、H5的UI组件,涉及文件选择、文件上传、文件预览等基础能力,开发者无需再去构建文件显示、列表等基本架构。

kaifangpingtaijiagou

名词解释


  • 企业内部开发

    企业依托亿方云强大的开放能力,将亿方云文件存储与共享的能力接入到企业自身的HR、OA、客户管理、业务管理等系统,实现文件的统一存储和协作。

  • access_token

    1.access_token是访问亿方云服务端开放接口的全局唯一凭证。

    2.正常情况下access_token有效期为6小时。

  • client_id

    client_id是企业接入亿方云开放平台的唯一性标识。开发者在申请开放平台应用时,系统会自动生成。

  • client_secret

    client_secret和client_id在企业申请开放平台时一同生成,使用client_id和client_secret可获取access_token。

  • 回调

    企业在申请亿方云开放平台时,可为应用设置一个URL。一些应用相关的重要事件发生时,亿方云向该URL地址发起http请求,此URL称之为回调地址。

  • 免登

    “免登”是指用户免除输入亿方云用户名和密码,应用便可获取用户身份,登录亿方云。

  • 应用专属账号

    员工在使用企业内部应用的过程中,可将从本地上传或者从亿方云选择的文件保存到应用专属账号。企业内部应用将员工所上传的文件存储在应用专属账号中,可以控制用户预览、保存至亿方云、下载等权限,也可以将员工账号添加为文件夹的协作权限来授予员工相应的访问权限。

新手入门


第一步:申请开放平台

目前亿方云开放平台需要申请才能开放,具体的申请可直接拨打我司客服热线:400-993-9050。具体步骤开发者需要在企业控制台(只有企业管理员或联合管理员才能进入)里面申请应用,企业控制台-企业设置-开放平台中设置相关信息提交应用,待应用审核通过后即可进入第二步。

第二步:接口认证,获取授权

当审核通过后,则会分配一个client_id和client_secret应用审核通过后会获得该应用的client_id和client_secret,拿到这两个信息即可进行接口认证,获取相关的接口认证。

第三步:应用开发

接口认证获取授权后,即可调用亿方云提供的API、SDK、UI组件。

获取token


token类型介绍


企业级token

只能请求企业级API(路径中含有admin),示例如下:

{
   "access_token":"8afa8c99-4490-4f64-a3ce-ebfda52d893a",
   "refresh_token":"70903bbd-9825-4ef2-b967-0c6ae0fb0946",
   "scope":"admin",
   "token_type":"bearer",
   "expires_in":21599
}

用户级token

只能请求用户级API,示例如下:

{
   "access_token":"7e40bd40-080f-4131-ba8b-7f6ce5ac0a83",
   "refresh_token":"98db229d-1a76-4491-b2c7-37be7f37dcaf",
   "scope":"all",
   "token_type":"bearer",
   "expires_in":21599
}

构建请求参数


第一步:获取相关参数

向云盘工作人员获取企业id,开放平台的client_id和client_secret参数

第二步:生成请求header

该接口使用Basic Auth的方式校验client的信息。具体做法是在header中添加类似于"Authorization: Basic xxxxxxxxx"。其中"xxxxxxxxx"是通过client_id和client_secret算出来的,具体算法为Base64Encode(client_id + ":" + client_secret)

第三步:生成请求参数

组装map集合,map集合参数如下:

参数字段 字段类型 字段说明
yifangyun_sub_type string 授权对象类型,只能是enterprise或者user
sub string 授权对象id。授权对象类型为enterprise,sub为企业id;授权对象类型为user,sub为用户id
exp timestamp 过期时间戳,不能超过iat(若iat不存在则记请求到达服务器时间)60s
iat timestamp jwt生成时的时间戳(单位为秒)
jti string jwt的唯一标识,每个jwt应当都有唯一的jti

组装完成的map集合示例:

 {
    "sub": "21791",
    "yifangyun_sub_type": "enterprise",
    "exp": "1725590139",
    "iat": "1725590079",
    "jti": "17255900799152711bfbc-435f-45b6-a8d4-6e750e14b005"
 }

将组装好的map转成字符串并其进行:Base64Encode,生成assertion参数,转换完成的assertion示例:

 ewogICAgInN1YiI6ICIyMTc5MSIsCiAgICAieWlmYW5neXVuX3N1Yl90eXBlIjogImVudGVycHJpc2UiLAogICAgImV4cCI6ICIxNzI1NTkwMTM5IiwKICAgICJpYXQiOiAiMTcyNTU5MDA3OSIsCiAgICAianRpIjogIjE3MjU1OTAwNzk5MTUyNzExYmZiYy00MzVmLTQ1YjYtYThkNC02ZTc1MGUxNGIwMDUiCn0=

第四步:请求获取token

HTTP请求方式: POST URL参数:

参数字段 字段类型 字段说明
grant_type string 必须为jwt_simple
assertion string 第三步装好的字符串

请求示例:

 curl --location --request POST 'https://oauth.fangcloud.net/oauth/token?grant_type=jwt_simple&assertion=ewogICAgInN1YiI6ICIyMTc5MSIsCiAgICAieWlmYW5neXVuX3N1Yl90eXBlIjogImVudGVycHJpc2UiLAogICAgImV4cCI6ICIxNzI1NTkwMTM5IiwKICAgICJpYXQiOiAiMTcyNTU5MDA3OSIsCiAgICAianRpIjogIjE3MjU1OTAwNzk5MTUyNzExYmZiYy00MzVmLTQ1YjYtYThkNC02ZTc1MGUxNGIwMDUiCn0=' 
 --header 'Authorization: Basic M2RjMjcyNjQtMGJhNi00ZjQ3LWI3ZGUtNjhiNWFhNWFiZDQxOjA1MmQ4YjAzLWRiNTEtNDM3Ni04ZTA1LTZhNmU1NWNlNGMzMA==' 

获取用户id


获取用户信息API接口地址

根据接口返回用户信息中的用户id,可以生成对应的用户token

请求示例

curl --location 'https://open.fangcloud.com/api/v2/admin/user/get_user_info?identifier=18888888888@test.com&type=simple_phone_or_email' \
--header 'Authorization: Bearer 021ae7ad-a803-49d8-a070-52b84e6c0705' 

postman请求示例

image-20230222152358554

获取token的java示例代码

package com.example.liangxiaoshengdemo.token.simple_jwt; 
 
import com.alibaba.fastjson.JSON; 
import com.alibaba.fastjson.JSONObject; 
import org.apache.http.HttpEntity; 
import org.apache.http.HttpResponse; 
import org.apache.http.client.methods.HttpPost; 
import org.apache.http.impl.client.DefaultHttpClient; 
import org.apache.http.util.EntityUtils; 
import java.util.*; 
 
public class DemoSimple { 
 
    static String clientId = ""; 
    static String clientSecret = ""; 
 
    // jwt密钥文件中的enterprise_id,生成企业token使用 
    static long enterpriseId = 0L; 
    // jwt密钥文件中的platform_id 
    static long platformId = 0L; 
    // 用户id,通过接口获取,生成个人token使用 
    static long userId = 0L; 
    // 开放平台获取token地址(专有云需要修改) 
    static String oauthHost = "https://oauth.fangcloud.com"; 
 
    public static void main(String[] args) throws Exception { 
 
        // 生成企业token 
        JSONObject accessTokenAdmin= getAccessToken(oauthHost, clientId, clientSecret, enterpriseId, false); 
        System.out.println("accessTokenAdmin" + JSON.toJSONString(accessTokenAdmin)); 
        // 生成个人token 
        JSONObject accessTokenUser = getAccessToken(oauthHost, clientId, clientSecret, userId, true); 
        System.out.println("accessTokenUser" + JSON.toJSONString(accessTokenUser)); 
  } 
 
    public static JSONObject getAccessToken (String oauthUrl, String appKey, String appSecret, Long id, Boolean isUser) { 
        try{ 
             Map<String, String> dataMap = new HashMap<>(); 
             String yifangyun_sub_type = ""; 
             if (isUser) { 
                yifangyun_sub_type = "user"; 
              } else { 
               yifangyun_sub_type = "enterprise"; 
             } 
 
             dataMap.put("yifangyun_sub_type", yifangyun_sub_type); //授权对象类型   enterprise为企业   user为用户 
             dataMap.put("sub", String.valueOf(id)); //如果授权对象类型为企业 这里输入企业id,如果授权对象类型为user这边输入userid 
             dataMap.put("exp", String.valueOf(getExpirationTimeSecondsInTheFuture(60).getTime()/1000));//过期时间戳,不能超过iat(若iat不存在则记请求到达服务器时间)60s 
             dataMap.put("iat", String.valueOf(new Date().getTime()/1000));//当前 时间 
             dataMap.put("jti", System.currentTimeMillis() + UUID.randomUUID().toString());//随机字符串 
 
             String dataJson = JSON.toJSONString(dataMap); 
             String encodeJson = Base64.getEncoder().encodeToString(dataJson.getBytes()); 
             return getToken(encodeJson, oauthUrl, appKey, appSecret); 
        }catch (Exception e){ 
             e.printStackTrace(); 
        } 
        return null; 
    } 
 
 
    /** 
    * 获取token 
    * @param compactJwt jwt字符串 
    * @param oauthUrl 接口地址 
    * @param appKey client_id 
    * @param appSecret client_secret 
    * @return 返回接口token 
    */ 
    private static JSONObject getToken(String compactJwt, String oauthUrl, String appKey, String appSecret){ 
          String res = ""; 
          DefaultHttpClient httpclient; 
          try { 
                httpclient = new DefaultHttpClient();//https请求 存在证书问题,通过此方式信任所有证书 
 
                String url = oauthUrl + "/oauth/token?grant_type=jwt_simple&assertion=" + compactJwt; 
                System.out.println(url); 
                HttpPost httppost = new HttpPost(url); 
 
                String client = appKey + ":" + appSecret;  //组装client_id和client_secret 
                byte[] bytes = client.getBytes(); 
                String base64Client = Base64.getEncoder().encodeToString(bytes);//base64加密 
                System.out.println(base64Client); 
                httppost.addHeader("Authorization","Basic "+base64Client); 
                HttpResponse response = httpclient.execute(httppost); 
 
                HttpEntity entity = response.getEntity(); 
                res = EntityUtils.toString(entity); 
                return JSONObject.parseObject(res); 
 
          }catch (Exception e){ 
                e.printStackTrace(); 
                return null; 
          } 
    } 
 
    private static Date getExpirationTimeSecondsInTheFuture(int seconds) { 
          Calendar calendar = Calendar.getInstance(); 
          calendar.setTime(new Date()); 
          calendar.add(Calendar.SECOND, seconds); 
          return calendar.getTime(); 
    } 
} 

获取token的python示例代码

import hashlib 
import json 
import random 
import time 
import base64 
import requests 
 
# jwt密钥文件中的enterprise_id,生成企业token使用 
enterprise_id = 123 
# 用户id,通过接口获取,生成个人token使用 
user_id = 0 
# jwt密钥文件中的client_id 
client_id = "xxxx" 
# jwt密钥文件中的client_secret 
client_secret = "xxxx" 
# 开放平台获取token地址(专有云需要修改) 
oauth_url = 'https://oauth.fangcloud.com' 
# 开放平台api地址(专有云需要修改) 
open_url = 'https://open.fangcloud.com' 
 
class Test(): 
 
  def jwt_token(id, type): 
 
    jti = "".join(random.sample('abcdefghijklmnopqrstuvwxyz!@#$%^&*1234567890', 16)).replace(' ', '') 
    m = hashlib.md5() 
    m.update(jti.encode("utf-8")) 
    jti_md5 = m.hexdigest() 
    sub_type = '' 
    if(type == 'enterprise'): 
      sub_type = "enterprise" 
    elif(type == 'user'): 
      sub_type = "user" 
 
    payload = { 
    "yifangyun_sub_type": sub_type, 
    "sub": id, 
    "exp": int(time.time()) + 60, 
    "iat": int(time.time()), 
    "jti": jti_md5, 
    } 
 
    headers = { 
    'Authorization': 'Basic '+ base64.b64encode((client_id + ":" + client_secret).encode('utf-8')).decode('ascii') 
    } 
 
    url = oauth_url + '/oauth/token?grant_type=jwt_simple&assertion=' + base64.b64encode(json.dumps(payload).encode('utf-8')).decode('ascii') 
    return requests.post(url, headers=headers).text 
 
  enterprise_token = jwt_token(enterprise_id, 'enterprise') 
  print('enterprise_token:' + enterprise_token) 
  user_token = jwt_token(user_id, 'user') 
  print('user_token:' + user_token) 

调用接口


请求通用参数


所有的接口在访问时需要在HTTP header中带上access_token(通过jwt模式获取的)。对于含有请求参数的接口,通常是一些POST、PUT或者DELETE接口,还需要设置Content-Type来指定参数的格式。如果需要访问不同版本的API,就需要在请求路径上指定具体版本,如果需要返回不同格式的response body,那么还需要设置Accept。所有的参数都应该采用utf-8的编码:

参数字段 是否必填 字段说明
Share-Link-Token 分享链接token
Share-Link-Verification-Code 分享链接码
Authorization Bearer {access_token}
Content-Type application/json

API请求示例


curl --location --request GET 'https://open.fangcloud.com/api/v2/admin/user/all?platform_id=1&page_id=0&page_capacity=10' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 76ebc21a-e52e-4800-9ada-a1cdd2f77856' 

接口调用限制


目前对于开放平台的请求, 我们做了请求的频次限制, 在所有api请求的返回结果中会有三个header表示频次限制相关的信息

返回header 字段类型 字段说明
X-Rate-Limit-Limit int 当前接口请求次数的上限, 固定数值
X-Rate-Limit-Remaining int 当前接口允许请求的剩余次数
X-Rate-Limit-Reset int 当前接口允许请求的剩余次数恢复到上限所需要的时间(单位为秒)

当请求超过了频次限制, 返回结果的HTTP Status Code为429, 返回body如下

{
   "errors": [
       {
           "code": "rate_limit",
           "msg": "Rate limit exceeded!"
       }
   ],
   "request_id": "d3e1088f-28af-495d-b7ee-a9e58e989b76"
}

异常处理


异常格式

api接口的异常返回可以分为两类,参数验证错误和业务错误

参数验证错误的返回如又所示:

{
   "errors": [
       {
           "msg": "不能为空",
           "code": "request_data_invalid",
           "field": "folder_id"
       }
   ],
   "request_id": "fdjklsa-asdrwer2312314q-asdfasfav-falsfdjas"
}

参数验证错误有统一的错误码request_data_invalid,具体错误信息会在msg中提示,field提示错误的字段

常见的错误msg包括:

  • 不能为null
  • 不能为空
  • 不能包含null
  • 最小不能小于{value}
  • 长度需要在{min}和{max}之间
  • 个数必须在{min}和{max}之间

业务错误的异常格式如下所示:

{
   "errors": [
       {
           "msg": "文件不存在",
           "code": "file_not_found"
       }
   ],
   "request_id": "fdjklsa-asdrwer2312314q-asdfasfav-falsfdjas"
}
{
   "errors": [
       {
           "msg": "不能为空",
           "code": "request_data_invalid",
           "field": "folder_id"
       }
   ],
   "request_id": "fdjklsa-asdrwer2312314q-asdfasfav-falsfdjas"
}

业务错误通常以不同的code来进行区分

错误码

code message
request_data_invalid 请求参数存在错误
permission_denied 权限不足
file_not_found 文件不存在
folder_not_found 文件夹不存在
file_deleted 文件已删除
folder_deleted 文件夹已删除
file_in_trash_not_found 文件不在回收站
folder_in_trash_not_found 文件夹不在回收站
file_name_conflict 文件命名冲突
folder_name_conflict 文件夹命名冲突
folder_empty_in_trash 回收站无文件夹
folder_parent_deleted 父文件夹已被删除
move_to_itself 文件夹不能移动到自身
move_to_subfolder 不能移动到子文件夹
copy_to_itself 文件夹不能拷贝到自身
copy_to_subfolder 不能拷贝到子文件夹
item_name_invalid 文件或文件夹名称不合法
item_name_size_incorrect 文件或文件夹名称长度错误
empty_trash 回收站为空
request_data_invalid 请求参数错误
exceed_enterprise_space_limit 超过企业空间限制
exceed_user_space_limit 超过用户空间限制
folder_is_descendant 目标文件夹是移动文件夹的子目录
user_not_found 用户不存在
user_profile_pic_not_found 用户头像不存在
user_profile_pic_key_not_found 用户头像的key未传入
user_profile_pic_key_incorrect 用户头像的key与user_id不匹配
share_link_password_not_provided 没有提供分享链接密码
share_link_access_type_invalid 分享链接的 access 类型无效
due_time_passed 指定的截止时间已过期
share_link_not_found_or_deleted 分享链接找不到或已删除
share_link_resource_id_not_provided 没有提供文件或文件夹id
share_link_resource_id_ambiguous 分享链接资源不明确(同时提供了文件和文件夹id)
share_link_password_not_correct 分享链接密码不正确
share_link_password_size_incorrect 分享链接密码长度最大33位
share_link_password_invalid 分享链接密码只能使用数字和字母
share_link_expired 分享链接已过期
collab_not_found 协作不存在
collab_role_invalid 协作角色无效
collab_user_has_been_invited 用户已经被邀请
collab_user_not_in_same_enterprise 被邀请用户不在同一企业
collab_group_not_supported 不支持群组协作
cannot_invite_item_owner 无法邀请拥有者
comment_not_found 评论不存在
collab_related_folder_deleted 协作相关的文件夹已经被删除
enterprise_is_expired 企业套餐已经过期
department_not_found 部门不存在
department_name_conflict 部门名冲突
user_not_in_enterprise 用户不在企业中
user_already_in_department 用户已经在该部门中
user_exceed_department_limit 用户所在的部门数超过部门限制(100)
user_not_in_department 用户不在该部门中
group_name_conflict 群组名冲突
user_already_in_group 用户已经在该群组中
user_not_in_group 用户不在该群组中
user_email_or_phone_invalid 用户邮箱或手机无效
user_already_deleted 该用户已被删除
user_already_invited 该用户已被邀请
user_already_registered 该用户已被注册
user_receive_items_needed 需要接收文件的用户
department_space_total_exceeds_enterprise_limit 部门分配空间超出企业总可用空间
department_having_children_can_not_delete 无法删除存在子部门的部门
user_space_total_exceeds_enterprise_limit 用户分配空间超出企业总可用空间
user_received_items_not_in_same_enterprise 接收文件的用户不在同一企业中
invalid_enterprise_storage 无效的企业存储
department_director_can_not_delete 无法删除部门管理员
user_deleted_is_user_received_items 接收文件的用户不能是被删除者
user_not_active 用户未激活
preview_file_not_generated 预览文件未生成
can_not_download_yiqixie_file 无法下载一起写文件
user_receive_items_need_active 文件接受者尚未激活
timestamp_range_invalid 非法的时间戳范围
enterprise_not_enable_sync_account 企业未开启账号同步
cannot_provide_both_yfy_id_and_custom_id 不能同时提供亿方云id和自定义id
yfy_id_and_custom_id_not_null 亿方云id和自定义id不能同时为空
  • 用户传入的json格式错误,返回invalid_error

协作管理

邀请协作

Request Body schema: */*

邀请协作所需参数

folder_id
required
integer <int64> (协作文件夹id)
required
object (邀请对象)
invitation_message
string (邀请信息,长度不能超过140个字符)

Responses

Response samples

Content type
application/json
{
  • "item": {
    },
  • "id": 412027,
  • "accessible_by": {
    },
  • "accepted": true,
  • "role": "viewer"
}

批量邀请协作

Request Body schema: */*

批量邀请协作所需参数

folder_id
required
integer <int64> (协作文件夹id)
required
Array of objects (邀请对象)
invitation_message
string (邀请信息,长度不能超过140个字符)

Responses

Response samples

Content type
application/json
{
  • "folder_id": 179000000092,
  • "accessible_by": [
    ],
  • "invitation_message": "hello"
}

删除协作

path Parameters
id
required
integer <int64>

协作ID

Responses

Response samples

Content type
application/json
{
  • "success": true
}

获取协作信息

path Parameters
id
required
integer <int64>

协作ID

Responses

Response samples

Content type
application/json
{
  • "item": {
    },
  • "id": 412027,
  • "accessible_by": {
    },
  • "accepted": true,
  • "role": "viewer"
}

批量移出协作

Request Body schema: */*

批量移出协作所需参数

collab_ids
required
Array of integers <int64> (需要被删除的协作用户(支持批量)) [ 1 .. 100 ] items [ items <int64 > ]
folder_id
required
integer <int64> (协作文件夹id)

Responses

Response samples

Content type
application/json
{
  • "success": true
}

更新协作

path Parameters
id
required
integer <int64>

协作ID

Request Body schema: */*

新的权限

role
required
string (更新角色类型)
coowner:共同所有者; editor:编辑者; online_collaborator:在线协作者; viewer_uploader:查看/上传者; viewer:查看者; previewer_uploader:预览+上传者; previewer:预览者; uploader:上传者; reset:禁止访问

Responses

Response samples

Content type
application/json
{
  • "item": {
    },
  • "id": 412027,
  • "accessible_by": {
    },
  • "accepted": true,
  • "role": "viewer"
}

评论管理

添加评论

Request Body schema: */*

添加的评论信息

file_id
required
integer <int64> (评论文件id)
content
required
string (评论文本,长度不能超过1001个字符@[user_id:评论内容])

Responses

Response samples

Content type
application/json
{
  • "item": {
    },
  • "id": 43156,
  • "content": "@[12032111:的]",
  • "created_at": 1501148332,
  • "user": {
    }
}

删除评论

path Parameters
id
required
integer <int64>

删除的评论id

Responses

Response samples

Content type
application/json
{
  • "success": true
}

部门管理

获取子部门列表

path Parameters
id
required
integer <int64>

部门ID

query Parameters
permission_filter
boolean

是否过滤权限

Responses

Response samples

Content type
application/json
{
  • "children": [
    ]
}

获取部门信息

path Parameters
id
required
integer <int64>

部门id

Responses

Response samples

Content type
application/json
{
  • "director": {
    },
  • "id": 65820,
  • "created_at": 1513102764,
  • "children_departments_count": 1,
  • "direct_item_count": 1,
  • "name": "亿方云测试",
  • "user_count": 1,
  • "parent_id": 0,
  • "order": 1
}

获取自己所在的部门

Responses

Response samples

Content type
application/json
{
  • "has_children_departments": true,
  • "children": [
    ],
  • "id": 893694,
  • "name": "venus金星计划物Train版Swift理环境部署",
  • "user_count": 6,
  • "parent_id": 0
}

获取部门成员列表

path Parameters
id
required
integer <int64>

部门ID

query Parameters
query_words
string

查询关键字

page_id
integer <int32> >= 0

页码

Responses

Response samples

Content type
application/json
{
  • "users": [
    ],
  • "total_count": 4,
  • "page_id": 0,
  • "page_capacity": 500,
  • "page_count": 1
}

设备管理

加入同步

path Parameters
device_token
required
string

设备token

Request Body schema: */*

加入同步的信息

object (同步目标信息)

Responses

Response samples

Content type
application/json
{
  • "success": true
}

获取设备同步状态

path Parameters
device_token
required
string

设备token

Responses

Response samples

Content type
application/json
{
  • "synced_folders": [
    ],
  • "synced_department_spaces": [
    ],
  • "is_synced_personal_space": false,
  • "is_synced_collab_space": false
}

移除同步

path Parameters
device_token
required
string

设备token

Request Body schema: */*

移除同步的信息

object (同步目标信息)

Responses

Response samples

Content type
application/json
{
  • "success": true
}

文件管理

拷贝文件

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/file/75003907526/copy' \
--header 'Authorization: Bearer 583fad43-3265-45df-9e13-91fa5a22a2ca' \
--header 'Content-Type: application/json' \
--data '{
 "target_folder_id": 75000441887
  }' 
path Parameters
id
required
integer <int64>

文件的ID

Request Body schema: */*

拷贝文件的请求

target_folder_id
required
integer <int64> (目标文件夹id)

Responses

Response samples

Content type
application/json
{
  • "space": {
    },
  • "sha1": "dc5d8f86d8d33eac2145eddaf1ff85dd38dcca5f",
  • "comments_count": 0,
  • "extension_category": "document",
  • "type": "file",
  • "id": 75003903445,
  • "name": "0EB21E7F3E887DAEADC3E1B047BCA6AC (1).docx",
  • "size": 21087,
  • "created_at": 1624330900,
  • "modified_at": 1624330900,
  • "modified_by": {
    },
  • "description": "",
  • "path": [
    ],
  • "owned_by": {
    },
  • "parent": {
    },
  • "sequence_id": 8,
  • "in_trash": false,
  • "is_deleted": false,
  • "is_frequently_used": false
}

按路径拷贝文件

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/file/75003907526/copy_by_path' \
--header 'Authorization: Bearer 583fad43-3265-45df-9e13-91fa5a22a2ca' \
--header 'Content-Type: application/json' \
--data '{
 "target_folder_path": "75000441887" 
  }' 
path Parameters
id
required
integer <int64>

文件的ID

Request Body schema: */*

拷贝文件的请求

target_folder_path
required
string (路径名,以/划分文件夹,根目录在个人文件下,文件夹名称必须是1到222个字符,并且不能含有/ ? : * " > < |且末尾不能为“.”)

Responses

Response samples

Content type
application/json
{
  • "space": {
    },
  • "sha1": "dc5d8f86d8d33eac2145eddaf1ff85dd38dcca5f",
  • "comments_count": 0,
  • "extension_category": "document",
  • "type": "file",
  • "id": 75003903445,
  • "name": "0EB21E7F3E887DAEADC3E1B047BCA6AC (1).docx",
  • "size": 21087,
  • "created_at": 1624330900,
  • "modified_at": 1624330900,
  • "modified_by": {
    },
  • "description": "",
  • "path": [
    ],
  • "owned_by": {
    },
  • "parent": {
    },
  • "sequence_id": 8,
  • "in_trash": false,
  • "is_deleted": false,
  • "is_frequently_used": false
}

创建空白文件,支持office类型

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/file/create_blank_file' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer a2a192ea-cb37-4c0c-b8d5-574232fa853b' \
--header 'Cookie: lang=zh-CN' \
--data-raw '{
 "departmentId":0,
 "name":"111",
 "parentEnterpriseId":21791,
 "nameConflictResolveStrategy":"2",
 "parentFolderId":0,
 "type":"1" 
 }' 
Request Body schema: */*

文件信息

name
required
string (新文件文件名)
type
required
string (文件类型)
1:doc类型; 2:ppt类型; 3:xls类型
parentFolderId
required
integer <int64> (父文件夹Id)
parentEnterpriseId
required
integer <int64> (企业id,若为外协文件夹需要填写对应企业id)
departmentId
required
integer <int64> (部门id)
nameConflictResolveStrategy
required
string (命名冲突解决策略(固定传2))
2:系统自动重命名(当前仅支持这种)

Responses

Response samples

Content type
application/json
{
  • "space": {
    },
  • "sha1": "dc5d8f86d8d33eac2145eddaf1ff85dd38dcca5f",
  • "comments_count": 0,
  • "extension_category": "document",
  • "type": "file",
  • "id": 75003903445,
  • "name": "0EB21E7F3E887DAEADC3E1B047BCA6AC (1).docx",
  • "size": 21087,
  • "created_at": 1624330900,
  • "modified_at": 1624330900,
  • "modified_by": {
    },
  • "description": "",
  • "path": [
    ],
  • "owned_by": {
    },
  • "parent": {
    },
  • "sequence_id": 8,
  • "in_trash": false,
  • "is_deleted": false,
  • "is_frequently_used": false
}

删除文件,被删除的文件将进入回收站

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/folder/179000000087/delete' \
 --header 'Authorization: Bearer bdd88b1c-aa8a-4126-b380-a1e64f9348a5'  
path Parameters
id
required
integer <int64>

删除文件的ID

Responses

Response samples

Content type
application/json
{
  • "success": true
}

从回收站中彻底删除文件,或者清空回收站

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/folder/179000000087/delete_from_trash' \
 --header 'Authorization: Bearer bdd88b1c-aa8a-4126-b380-a1e64f9348a5'  
path Parameters
id
required
integer <int64>

从回收站删除文件的ID

Responses

Response samples

Content type
application/json
{
  • "success": true
}

下载文件

请求示例(使用用户token):

curl --location --request GET 'https://open.fangcloud.com/api/v2/file/75003903551/download?version=0&valid_period=100' \
--header 'Authorization: Bearer 775eb65c-8545-419d-823c-ffb5d42d75c0' 
path Parameters
id
required
integer <int64>

文件的ID

query Parameters
version
integer <int64>
Default: 0

文件的版本信息

external_enterprise_id
integer <int64>

外协文件的企业ID

Responses

获取文件特定版本信息

请求示例(使用用户token):

curl --location --request GET 'https://open.fangcloud.com/api/v2/file/75003907526/version/75000911769/info' \
--header 'Authorization: Bearer 775eb65c-8545-419d-823c-ffb5d42d75c0' 
path Parameters
id
required
integer <int64>

文件id

version_id
required
integer <int64>

文件版本id

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "id": 0,
  • "file_id": 0,
  • "sha1": "string",
  • "name": "string",
  • "size": 0,
  • "modified_at": 0,
  • "modified_by": {
    },
  • "current": true,
  • "remark": "string",
  • "description": "string"
}

删除文件版本

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/file/75003907526/version/75000911810/delete' \
--header 'Authorization: Bearer 775eb65c-8545-419d-823c-ffb5d42d75c0' 
path Parameters
id
required
integer <int64>

文件id

version_id
required
integer <int64>

文件版本id

Responses

Response samples

Content type
application/json
{
  • "success": true
}

获取文件版本列表

请求示例(使用用户token):

curl --location --request GET 'https://open.fangcloud.com/api/v2/file/75003907526/versions' \
--header 'Authorization: Bearer 775eb65c-8545-419d-823c-ffb5d42d75c0' 
path Parameters
id
required
integer <int64>

文件id

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "file_versions": [
    ]
}

提升版本为当前版本

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/file/75003907526/version/75000911769/promote' \
--header 'Authorization: Bearer 775eb65c-8545-419d-823c-ffb5d42d75c0' 
path Parameters
id
required
integer <int64>

文件id

version_id
required
integer <int64>

文件版本id

Responses

Response samples

Content type
application/json
{
  • "space": {
    },
  • "sha1": "dc5d8f86d8d33eac2145eddaf1ff85dd38dcca5f",
  • "comments_count": 0,
  • "extension_category": "document",
  • "type": "file",
  • "id": 75003903445,
  • "name": "0EB21E7F3E887DAEADC3E1B047BCA6AC (1).docx",
  • "size": 21087,
  • "created_at": 1624330900,
  • "modified_at": 1624330900,
  • "modified_by": {
    },
  • "description": "",
  • "path": [
    ],
  • "owned_by": {
    },
  • "parent": {
    },
  • "sequence_id": 8,
  • "in_trash": false,
  • "is_deleted": false,
  • "is_frequently_used": false
}

获取回收站中的文件信息

请求示例(使用用户token):

curl --location 'https://open.fangcloud.com/api/v2/file/75003624924/trash' \
 --header 'Authorization: Bearer bdd88b1c-aa8a-4126-b380-a1e64f9348a5'  
path Parameters
id
required
integer <int64>

文件id

Responses

Response samples

Content type
application/json
{
  • "deleted_at": 1624869434,
  • "deleted_by": {
    },
  • "sha1": "dc5d8f86d8d33eac2145eddaf1ff85dd38dcca5f",
  • "comments_count": 0,
  • "extension_category": "document",
  • "type": "file",
  • "id": 75003624924,
  • "name": "11111.docx",
  • "size": 21087,
  • "created_at": 1622001702,
  • "modified_at": 1624354160,
  • "modified_by": {
    },
  • "description": "",
  • "path": [
    ],
  • "owned_by": {
    },
  • "parent": {
    },
  • "sequence_id": 9,
  • "in_trash": false,
  • "is_deleted": false,
  • "is_frequently_used": false
}

获取文件详细信息

请求示例(使用用户token):

curl --location 'https://open.fangcloud.com/api/v2/file/75003903445/info_v2' \
 --header 'Authorization: Bearer bc326c4a-6eb0-4790-8cf3-3d19232af711' 
path Parameters
id
required
integer <int64>

文件id

query Parameters
external_enterprise_id
integer <int64>

外协企业id,文件为外协企业文件时必填

Responses

Response samples

Content type
application/json
{
  • "space": {
    },
  • "sha1": "dc5d8f86d8d33eac2145eddaf1ff85dd38dcca5f",
  • "comments_count": 0,
  • "extension_category": "document",
  • "type": "file",
  • "id": 75003903445,
  • "name": "0EB21E7F3E887DAEADC3E1B047BCA6AC (1).docx",
  • "size": 21087,
  • "created_at": 1624330900,
  • "modified_at": 1624330900,
  • "modified_by": {
    },
  • "description": "",
  • "path": [
    ],
  • "owned_by": {
    },
  • "parent": {
    },
  • "sequence_id": 8,
  • "in_trash": false,
  • "is_deleted": false,
  • "is_frequently_used": false
}

获取最近使用文件列表

请求示例(使用用户token):

curl --location --request GET 'https://open.fangcloud.com/api/v2/file/recent_items?limit=1' \
--header 'Authorization: Bearer 775eb65c-8545-419d-823c-ffb5d42d75c0' 
query Parameters
limit
required
integer <int32> >= 0

获取的条数

Responses

Response samples

Content type
application/json
{
  • "files": [
    ],
  • "folders": [ ],
  • "total_count": 2,
  • "page_id": 0,
  • "page_capacity": 20,
  • "page_count": 1
}

获取文件的评论列表

请求示例(使用用户token):

curl --location --request GET 'https://open.fangcloud.com/api/v2/file/75003907071/comments' \
--header 'Authorization: Bearer 775eb65c-8545-419d-823c-ffb5d42d75c0' 
path Parameters
id
required
integer <int64>

文件id

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "comments": [
    ]
}

标记最近使用

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/file/126000100472/mark_as_used' \
--header 'Authorization: Bearer 775eb65c-8545-419d-823c-ffb5d42d75c0' 
path Parameters
item_id
required
integer <int64>

文件id

Responses

Response samples

Content type
application/json
{
  • "success": true
}

移动文件到目标文件夹

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/folder/179000000087/move' \
  --header 'Authorization: Bearer d8ec3bc7-c7f2-40b6-a591-7b03c134478f' \
  --header 'Content-Type: application/json' \
  --data-raw '{    
 "target_folder_id": 179000000178,    
 "target_space": {        
     "type": "department",        
     "id": 179000000178    
     }
 }'  
path Parameters
id
required
integer <int64>

移动文件的ID

Request Body schema: */*

目标位置

target_folder_id
required
integer <int64> (目标文件夹id)

Responses

Response samples

Content type
application/json
{
  • "success": true
}

上传文件新版本

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/file/75003685568/new_version_v2' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 1cd9081c-aa2c-4f30-a619-f32663dc57cc' \
--data '{
  "name": "报表v1.0.pdf",
  "upload_type": "api",
  "remark": "新版本",
}'  

该接口会返回上传地址,获取到上传地址后,上传文件示例:

curl --location 'https://upload01.fangcloud.com/upload/d125644c2e43449a8becbcf9217c5dcf/ae03113d47ed2732cc40480906705861869c2e7f7687528e29feee5c3ae1793c' \
--header 'Cookie: lang=zh-CN' \
--form 'file=@"/Users/liangxiaosheng/FangcloudV2/personal_space.localized/个人工作文件/个人/开放平台/开放平台使用文档/token介绍.jpg"'  ``` 
path Parameters
id
required
integer <int64>

文件id

Request Body schema: */*

上传新版本详细信息

name
required
string (文件名称,文件名称必须是1到222个字符,并且不能含有/ ? : * " > < \)
remark
string (上传新版本时对新版本的备注)
upload_type
required
string (上传类型)
固定传api
sha1
string (文件sha1)
external_enterprise_id
integer <int64> (v2版本支持该属性,用于处理获取外协文件预签名时,找不到该外协文件夹的企业ID问题)
file_size
integer <int64> (文件大小)
skip_logUser_activity
string (是否跳过记录行为)

Responses

批量下载文件

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/file/pack_download' \
--header 'Authorization: Bearer 583fad43-3265-45df-9e13-91fa5a22a2ca' \
--header 'Content-Type: application/json' \
--data '{
 "item_typed_ids": [
   "file_203003511640",
   "folder_203000428376"
 ]
  }' 
Request Body schema: */*

文件/文件夹例表

item_typed_ids
required
Array of strings (文件id或文件夹id)

Responses

从回收站中取回文件

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/folder/179000000087/restore_from_trash' \
 --header 'Authorization: Bearer bdd88b1c-aa8a-4126-b380-a1e64f9348a5'  
path Parameters
id
required
integer <int64>

从回收站回复的文件的ID

Responses

Response samples

Content type
application/json
{
  • "success": true
}

更新文件信息

请求示例(使用用户token):

curl --location 'https://open.fangcloud.com/api/v2/folder/179000000087/update' \
--header 'Authorization: Bearer 583fad43-3265-45df-9e13-91fa5a22a2ca' \
--header 'Content-Type: application/json' \
--data '{  
 "name": "new name" 
}' 
path Parameters
id
required
integer <int64>

更新文件的ID

Request Body schema: */*

文件的详细信息

name
string (文件名,文件名称必须是1到222个字符,并且不能含有/ ? : * " > < \)
description
string (文件描述,长度必须小于等于140个字符)

Responses

Response samples

Content type
application/json
{
  • "space": {
    },
  • "sha1": "dc5d8f86d8d33eac2145eddaf1ff85dd38dcca5f",
  • "comments_count": 0,
  • "extension_category": "document",
  • "type": "file",
  • "id": 75003903445,
  • "name": "0EB21E7F3E887DAEADC3E1B047BCA6AC (1).docx",
  • "size": 21087,
  • "created_at": 1624330900,
  • "modified_at": 1624330900,
  • "modified_by": {
    },
  • "description": "",
  • "path": [
    ],
  • "owned_by": {
    },
  • "parent": {
    },
  • "sequence_id": 8,
  • "in_trash": false,
  • "is_deleted": false,
  • "is_frequently_used": false
}

按路径上传文件

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/file/upload_by_path' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 003504d9-9a1e-4fc5-8b3e-188ee866b557' \
--header 'Cookie: lang=zh-CN' \
--data '{
  "target_folder_path": "123/123",
  "name": "text.tar",
  "upload_type": "api"
}' 

该接口会返回上传地址,获取到上传地址后,上传文件示例:

curl --location 'https://upload01.fangcloud.com/upload/d125644c2e43449a8becbcf9217c5dcf/ae03113d47ed2732cc40480906705861869c2e7f7687528e29feee5c3ae1793c' \
--header 'Cookie: lang=zh-CN' \
--form 'file=@"/Users/liangxiaosheng/FangcloudV2/personal_space.localized/个人工作文件/个人/开放平台/开放平台使用文档/token介绍.jpg"'  ``` 
Request Body schema: */*

上传文件详细信息

target_folder_path
required
string (路径名,以/划分文件夹,根目录在个人文件下,文件夹名称必须是1到222个字符,并且不能含有/ ? : * " > < |且末尾不能为“.”)
name
required
string (文件名称,文件名称必须是1到222个字符,并且不能含有/ ? : * " > < \)
upload_type
required
string (上传类型)
固定传api
is_covered
boolean (为true时重名情况下直接返回上传新版本的预签名链接,默认为false)

Responses

上传文件

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/file/upload_v2' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 1cd9081c-aa2c-4f30-a619-f32663dc57cc' \
--data '{
  "parent_id": "501002634212",
  "name": "报表v1.0.pdf",
  "upload_type": "api"
}'  

该接口会返回上传地址,获取到上传地址后,上传文件示例:

curl --location 'https://upload01.fangcloud.com/upload/d125644c2e43449a8becbcf9217c5dcf/ae03113d47ed2732cc40480906705861869c2e7f7687528e29feee5c3ae1793c' \
--header 'Cookie: lang=zh-CN' \
--form 'file=@"/Users/liangxiaosheng/FangcloudV2/personal_space.localized/个人工作文件/个人/开放平台/开放平台使用文档/token介绍.jpg"'  ``` 
Request Body schema: */*

上传文件详细信息

parent_id
required
integer <int64> (上传至的文件夹id)
name
required
string (准备上传的文件的名称,文件名称必须是1到222个字符,并且不能含有/ ? : * " > < \)
upload_type
required
string (上传类型)
固定传api
is_covered
boolean (为true时重名情况下直接返回上传新版本的预签名链接,默认为false)
file_size
integer <int64> (文件的大小)
external_enterprise_id
integer <int64> (v2接口支持该属性,用于处理获取外协文件预签名时,找不到该外协文件夹的企业ID问题)

Responses

文件夹管理

拷贝文件夹

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/folder/179000000087/copy' \
--header 'Authorization: Bearer 583fad43-3265-45df-9e13-91fa5a22a2ca' \
--header 'Content-Type: application/json' \
--data '{
 "target_folder_id": 179000000178 
  }' 
path Parameters
id
required
integer <int64>

文件夹id

Request Body schema: */*

拷贝目标文件夹信息

target_folder_id
required
integer <int64> (目标文件夹id)
department_id
integer <int64> (部门id) >= 0
target_folder_id传0时有效,不填则放在个人空间根目录,填写则放在部门空间根目录

Responses

Response samples

Content type
application/json
{
  • "space": {
    },
  • "item_count": 0,
  • "type": "folder",
  • "id": 203000426996,
  • "name": "new folders",
  • "size": 0,
  • "created_at": 1625039303,
  • "modified_at": 1625039303,
  • "description": "",
  • "path": [
    ],
  • "owned_by": {
    },
  • "parent": {
    },
  • "sequence_id": 0,
  • "in_trash": false,
  • "is_deleted": false,
  • "is_frequently_used": false
}

创建文件夹

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/folder/create' \
--header 'Authorization: Bearer 583fad43-3265-45df-9e13-91fa5a22a2ca' \
--header 'Content-Type: application/json' \
--data '{
 "name": "new folders" 
 "parent_id": 75000441887 
  }' 
Request Body schema: */*

文件夹的相信信息

name
required
string (文件夹名,文件夹名称必须是1到222个字符,并且不能含有/ ? : * " > < \)
parent_id
required
integer <int64> (父文件夹id)
department_id
integer <int64> (部门id) >= 0
parent_id传0时有效,不填则在个人空间根目录创建,填写则在部门空间根目录创建

Responses

Response samples

Content type
application/json
{
  • "space": {
    },
  • "item_count": 0,
  • "type": "folder",
  • "id": 203000426996,
  • "name": "new folders",
  • "size": 0,
  • "created_at": 1625039303,
  • "modified_at": 1625039303,
  • "description": "",
  • "path": [
    ],
  • "owned_by": {
    },
  • "parent": {
    },
  • "sequence_id": 0,
  • "in_trash": false,
  • "is_deleted": false,
  • "is_frequently_used": false
}

按路径创建文件夹

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/folder/create_by_path' \
--header 'Authorization: Bearer 583fad43-3265-45df-9e13-91fa5a22a2ca' \
--header 'Content-Type: application/json' \
--data '{
 "target_folder_path": "会议测试/9.25/研发" 
 "department_id": 894823 
  }' 
Request Body schema: */*

文件夹的相信信息

target_folder_path
required
string (路径名,以/划分文件夹,根目录在个人文件下,文件夹名称必须是1到222个字符,并且不能含有/ ? : * " > < |且末尾不能为“.”)
department_id
integer <int64> (不填则默认在个人文件下) >= 0

Responses

Response samples

Content type
application/json
{
  • "space": {
    },
  • "item_count": 0,
  • "type": "folder",
  • "id": 203000426996,
  • "name": "new folders",
  • "size": 0,
  • "created_at": 1625039303,
  • "modified_at": 1625039303,
  • "description": "",
  • "path": [
    ],
  • "owned_by": {
    },
  • "parent": {
    },
  • "sequence_id": 0,
  • "in_trash": false,
  • "is_deleted": false,
  • "is_frequently_used": false
}

从回收站中删除文件夹

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/folder/179000000087/delete_from_trash' \
--header 'Authorization: Bearer 775eb65c-8545-419d-823c-ffb5d42d75c0' 
path Parameters
id
required
integer <int64>

文件夹id

Responses

Response samples

Content type
application/json
{
  • "success": true
}

删除文件夹

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/folder/179000000087/delete' \
--header 'Authorization: Bearer 775eb65c-8545-419d-823c-ffb5d42d75c0' 
path Parameters
id
required
integer <int64>

文件夹id

Responses

Response samples

Content type
application/json
{
  • "success": true
}

获取回收站中的文件夹信息

请求示例(使用用户token):

curl --location --request GET 'https://open.fangcloud.com/api/v2/folder/179000000087/trash' \
--header 'Authorization: Bearer 775eb65c-8545-419d-823c-ffb5d42d75c0' 
path Parameters
id
required
integer <int64>

文件夹id

Responses

Response samples

Content type
application/json
{
  • "deleted_at": 1497513743,
  • "deleted_by": {
    },
  • "folder_type": "normal",
  • "id": 501000307503,
  • "path": [
    ],
  • "sequence_id": 0,
  • "name": "unittest_folder",
  • "owned_by": {
    },
  • "type": "folder",
  • "created_at": 1489053096,
  • "size": 0,
  • "description": "",
  • "parent": {
    },
  • "modified_at": 1489053096,
  • "modified_by": {
    },
  • "item_count": 0
}

获取文件夹下的单层文件和文件夹列表

请求示例(使用用户token):

curl --location --request GET 'https://open.fangcloud.com/api/v2/folder/293001037960/children?folder_id=293001037960&type=all&page_capacity=100&page_id=1' \
--header 'Authorization: Bearer 775eb65c-8545-419d-823c-ffb5d42d75c0' 
path Parameters
id
required
integer <int64>

文件夹id

query Parameters
page_id
integer <int32> >= 0

页号(默认0)

page_capacity
integer <int32> >= 1
Default: 20

页容量(默认20)

type
string

分为file,folder,all三种,默认为all

department_id
integer <int64> >= 0

部门id

sort_by
string

分为name,date,size三种,默认为date

sort_direction
string

分为desc,asc两种,默认为desc

Responses

Response samples

Content type
application/json
{
  • "files": [
    ],
  • "folders": [ ],
  • "total_count": 2,
  • "page_id": 0,
  • "page_capacity": 20,
  • "page_count": 1
}

获取与我协作的文件夹列表

请求示例(使用用户token):

curl --location --request GET 'https://open.fangcloud.com/api/v2/folder/collab_folders?page_id=0&page_capacity=10&sort_by=name&sort_direction=desc' \
--header 'Authorization: Bearer 775eb65c-8545-419d-823c-ffb5d42d75c0' 
query Parameters
page_id
integer <int32> >= 0

页号(默认0)

page_capacity
integer <int32> >= 1
Default: 20

页容量(默认20)

sort_by
string

排序方式(‘name’, ‘date’, ‘size’)

sort_direction
string

排序顺序(‘desc’, ‘asc’

Responses

Response samples

Content type
application/json
{
  • "files": [
    ],
  • "folders": [ ],
  • "total_count": 2,
  • "page_id": 0,
  • "page_capacity": 20,
  • "page_count": 1
}

获取部门首层文件夹列表

请求示例(使用用户token):

curl --location --request GET 'https://open.fangcloud.com/api/v2/folder/department_folders?department_id=596371' \
--header 'Authorization: Bearer 775eb65c-8545-419d-823c-ffb5d42d75c0' 
query Parameters
page_id
integer <int32> >= 0

页码

page_capacity
integer <int32> >= 1
Default: 20

每页容量

department_id
required
integer <int64> >= 0

部门ID

sort_by
string

排序方式,分为name,date,size三种,默认为date

sort_direction
string

排序顺序,分为desc,asc两种,默认为desc

Responses

Response samples

Content type
application/json
{
  • "files": [
    ],
  • "folders": [ ],
  • "total_count": 2,
  • "page_id": 0,
  • "page_capacity": 20,
  • "page_count": 1
}

获取文件夹详细信息

请求示例(使用用户token):

curl --location --request GET 'https://open.fangcloud.com/api/v2/folder/293001037960/info' \
--header 'Authorization: Bearer 775eb65c-8545-419d-823c-ffb5d42d75c0' 
path Parameters
id
required
integer <int64>

文件夹id

Responses

Response samples

Content type
application/json
{
  • "space": {
    },
  • "item_count": 0,
  • "type": "folder",
  • "id": 203000426996,
  • "name": "new folders",
  • "size": 0,
  • "created_at": 1625039303,
  • "modified_at": 1625039303,
  • "description": "",
  • "path": [
    ],
  • "owned_by": {
    },
  • "parent": {
    },
  • "sequence_id": 0,
  • "in_trash": false,
  • "is_deleted": false,
  • "is_frequently_used": false
}

获取个人首层文件夹与文件列表

请求示例(使用用户token):

curl --location --request GET 'https://open.fangcloud.com/api/v2/folder/personal_items?page_id=1&page_capacity=2&sort_by=name&sort_direction=asc' \
--header 'Authorization: Bearer 775eb65c-8545-419d-823c-ffb5d42d75c0' 
query Parameters
page_id
integer <int32> >= 0

页码

page_capacity
integer <int32> >= 1
Default: 20

每页容量

type
string

类型

sort_by
string
Example: sort_by=['name', 'date', 'size']

排序方式

sort_direction
string
Example: sort_direction=['desc', 'asc']

排序顺序

Responses

Response samples

Content type
application/json
{
  • "files": [
    ],
  • "folders": [ ],
  • "total_count": 2,
  • "page_id": 0,
  • "page_capacity": 20,
  • "page_count": 1
}

获取文件夹协作成员

请求示例(使用用户token):

curl --location --request GET 'https://open.fangcloud.com/api/v2/folder/203000425147/collabs' \
--header 'Authorization: Bearer 775eb65c-8545-419d-823c-ffb5d42d75c0' 
path Parameters
id
required
integer <int64>

文件夹id

Responses

Response samples

Content type
application/json
{
  • "final_role": "owner",
  • "collabs": [
    ]
}

移动文件夹

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/folder/179000000087/move' \
--header 'Authorization: Bearer 583fad43-3265-45df-9e13-91fa5a22a2ca' \
--header 'Content-Type: application/json' \
--data '{
 "target_folder_id": 179000000178 
  }' 
path Parameters
id
required
integer <int64>

文件夹id

Request Body schema: */*

移动目标文件夹信息

target_folder_id
required
integer <int64> (目标文件夹id)
department_id
integer <int64> (部门id) >= 0
target_folder_id传0时有效,不填则放在个人空间根目录,填写则放在部门空间根目录

Responses

Response samples

Content type
application/json
{
  • "success": true
}

从回收站中取回文件夹

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/folder/179000000087/restore_from_trash' \
--header 'Authorization: Bearer 775eb65c-8545-419d-823c-ffb5d42d75c0' 
path Parameters
id
required
integer <int64>

文件夹id

Responses

Response samples

Content type
application/json
{
  • "success": true
}

更新文件夹详细信息

请求示例(使用用户token):

curl --location --request POST 'https://open.fangcloud.com/api/v2/folder/179000000087/update' \
--header 'Authorization: Bearer 583fad43-3265-45df-9e13-91fa5a22a2ca' \
--header 'Content-Type: application/json' \
--data '{
 "name": "ew name" 
  }' 
path Parameters
id
required
integer <int64>

文件夹id

Request Body schema: */*

文件夹的详细信息

name
string (文件夹名,文件夹名称必须是1到222个字符,并且不能含有/ ? : * " > < \)
description
string (备注)

Responses

Response samples

Content type
application/json
{
  • "space": {
    },
  • "item_count": 0,
  • "type": "folder",
  • "id": 203000426996,
  • "name": "new folders",
  • "size": 0,
  • "created_at": 1625039303,
  • "modified_at": 1625039303,
  • "description": "",
  • "path": [
    ],
  • "owned_by": {
    },
  • "parent": {
    },
  • "sequence_id": 0,
  • "in_trash": false,
  • "is_deleted": false,
  • "is_frequently_used": false
}

常用文件管理

添加常用

Request Body schema: */*

常用类型

type
string (文件类型:file, folder)
id
string (文件id)

Responses

Response samples

Content type
application/json
{
  • "id": 2236301,
  • "owner_id": 13214349,
  • "item_type": "file",
  • "item_id": 203003487135,
  • "top": 0
}

删除常用

Request Body schema: */*

常用类型

type
string (文件类型:file, folder)
id
string (文件id)

Responses

Response samples

Content type
application/json
{
  • "success": true
}

获取常用列表

query Parameters
page_id
integer <int32> >= 0

页码

Responses

Response samples

Content type
application/json
{
  • "frequent_items": [
    ],
  • "total_count": 2
}

群组管理

获取公司可见群组

query Parameters
query_words
string

查询关键字

Responses

Response samples

Content type
application/json
{
  • "created_at": 1496992074,
  • "children_departments_count": 1,
  • "director": {
    },
  • "direct_item_count": 1,
  • "id": 65820,
  • "name": "xxx",
  • "user_count": 4,
  • "parent_id": 0,
  • "order": 1
}

获取群组成员列表

path Parameters
id
required
integer <int64>

群组id

query Parameters
query_words
string

查询关键字

page_id
integer <int32> >= 0

页码

Responses

Response samples

Content type
application/json
{
  • "users": [
    ],
  • "total_count": 4,
  • "page_id": 0,
  • "page_capacity": 500,
  • "page_count": 1
}

文件和文件夹公共管理

搜索文件

query Parameters
query_words
required
string

搜索关键词,不能为空

type
string

搜索类型,分为file,folder,all三种,默认为all

sort_by
string

排序方式,分为’name’, ‘date’, ‘size’, ‘score’

sort_direction
string

排序顺序,分为’desc’, ‘asc’

page_id
integer <int32>

第几页,每页默认20,默认为第0页

search_in_folder
integer <int64>

指定父文件夹,匹配的结果都是该文件夹的子文件或子文件夹

fields
integer <int64>

是否展示文件权限,需要展示填写perssion,不需要则不填写

query_filter
string

搜索过滤类型,分为file_name,content,creator, tag, all五种,默认为all

updated_time_range
string

指定更新时间范围搜索,格式为开始和结束时间戳,并以逗号分隔(如:‘1509954358,1509954360’),两个时间戳均可以不传,为空就表示不对开始或结束时间进行限制,但是逗号必须传(如:’,1509954360’ 或 ‘1509954358,’ 或 ‘,’)

department_id
string

根据存储空间 0 人个空间, -1 与我协作 111 部门id 搜索

precise_search
boolean

是否精确搜索

Responses

Response samples

Content type
application/json
{
  • "files": [
    ],
  • "folders": [ ],
  • "total_count": 2,
  • "page_id": 0,
  • "page_capacity": 20,
  • "page_count": 1
}

知识员工管理

新增Ai文件

Request Body schema: */*

新增Ai文件信息

data_value
required
string (数据值,url地址或者云盘文件id)
data_type
required
string (数据类型)
url(类型为url时:data_value传url地址)
file(类型为url时:data_value传云盘文件id)

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "ai_file_id": 758
}

数据集添加训练任务

Request Body schema: */*

数据集添加训练任务信息

data_id
required
integer <int64> (数据集id)
analysis_method
required
string (解析类型)
direct_segment(通用文本类型,支持云盘文件或者文件夹,支持文件类型:docx、txt、pdf、md)
qa(问答,只支持云盘文件,支持文件类型:csv、xlsx)
table(表格类型,只支持云盘文件,支持文件类型:xlsx)
file_type
required
string (文件类型)
file(文件)
folder(文件夹)
file_id
required
integer <int64> (文件夹或文件夹id)
object (训练参数(类型为direct_segment时候需要传))

Responses

Response samples

Content type
application/json
{
  • "success": true
}

ai对话接口(同步返回结果)

Request Body schema: */*

ai对话接口参数

question
required
string (问题)
gpt_type
required
string (模型类型,可选值:360GPT(智脑)、 Doubao(豆包))

Responses

Response samples

Content type
application/json
{
  • "result": "对不起,我无法实时获取当前的天气信息。如果你需要了解今天的天气情况,可以使用手机上的天气应用程序、访问气象网站或者收听当地的天气预报频道。这样你可以得到最准确和最新的天气信息。",
  • "success": true
}

知识号对话接口

  • 请求参数说明

    参数字段 字段类型 是否必须 字段说明
    messages List[Dict] 包含迄今为止对话消息列表,这是一个结构体的列表,每个元素类似如下:{"role": "user", "content": "你好"} role 只支持 user , assistant 其一,content 不得为空,user 为用户角色,assistant 为知识号角色
    knowledgeGptId string 知识员工id,chatType为ZSH_CHAT时必填,ASSISTANT_CHAT类型不需要传
    sessionId string 对话标识,调用方随机生成,同一对话需要保持一致
    chatType string 固定为:ZSH_CHAT(知识号对话,需传知识员工id),
    ASSISTANT_CHAT(AI助手对话)

    请求示例

    {
        "messages": [
            {"role": "user", "content": "如何调用开放平台?"}
        ],
        "knowledgeGptId": "291",
        "sessionId": "1721706231962_7248294",
        "chatType":"KNOWLEDGE_GPT"
    }
    
  • 返回字段说明

    stream 格式返回:

    content字段是AI回答的文本内容

    返回示例

    data:{"choices":[{"delta":{"content":"  // 包含了JWT令牌","role":"assistant"},"finishReason":"null","index":0,"message":{"content":"  // 包含了JWT令牌","role":"assistant"}}],"created":0,"object":""}
    
    data:{"choices":[{"delta":{"content":"的构建逻辑和网络请求实现\n","role":"assistant"},"finishReason":"null","index":0,"message":{"content":"的构建逻辑和网络请求实现\n","role":"assistant"}}],"created":0,"object":""}
    
  • 完整示例

    知识号对话:

    curl --location 'https://open.fangcloud.com/api/v2/knowledge/chatStream' \
    --header 'Authorization: Bearer cb806f3c-8d68-49ab-9925-4eefe3c8ec96' \
    --header 'Content-Type: application/json' \
    --data '{
        "messages": [
            {"role": "user", "content": "如何调用开放平台?"}
        ],
        "knowledgeGptId": "321",
        "sessionId": "1721706231962_7248294",
        "chatType":"ZSH_CHAT"
    }'
    

Responses

创建数据集

Request Body schema: */*

创建数据集信息

name
required
string (数据集名称)
info
string (数据集说明)

Responses

Response samples

Content type
application/json
{
  • "id": 123
}

数据集匹配测试

Request Body schema: */*

数据集匹配测试信息

data_id
required
integer <int64> (数据集id) >= 1
question
required
string (问题)

Responses

Response samples

Content type
application/json
{
  • "match_result_list": [
    ],
  • "success": true
}

创建知识员工

Request Body schema: */*

创建知识员工信息

name
required
string (知识员工名称)
intro
string (知识员工介绍)
system_prompt
string (知识员工设定(知识员工设定和数据集两项最少填一项))
chat_intro
string (开场白)
data_ids
Array of integers <int64> (数据集id列表(知识员工设定和数据集两项最少填一项)) [ items <int64 > ]
no_recall_replay
string (超纲回答(数据集列表不为空有效))
show_preview
boolean (不传为false(数据集列表不为空有效))
show_doc_source
boolean (不传为false(数据集列表不为空有效))
Array of objects (默认问题)
temperature
number <double> (回答风格,默认:0.6)
可选值:0.3、0.4、0.5、0.6、0.7、0.8、0.9

Responses

Response samples

Content type
application/json
{
  • "id": 123
}

删除数据集

Request Body schema: */*

删除数据集信息

data_id
required
integer <int64> (数据集id) >= 1

Responses

Response samples

Content type
application/json
{
  • "success": true
}

删除训练任务

Request Body schema: */*

删除训练任务信息

file_train_id
required
integer <int64> (训练任务id) >= 1

Responses

Response samples

Content type
application/json
{
  • "success": true
}

删除知识员工

Request Body schema: */*

删除知识员工信息

knowledge_gpt_id
required
integer <int64> (知识员工id) >= 1

Responses

Response samples

Content type
application/json
{
  • "success": true
}

编辑知识员工详情

Request Body schema: */*

编辑知识员工详情信息

knowledge_gpt_id
required
integer <int64> (知识员工id)
object (知识员工基本信息)
object (知识员工分享信息(不修改可以不传))
object (知识员工广场信息)

Responses

Response samples

Content type
application/json
{
  • "success": true
}

获取Ai文件详情

Request Body schema: */*

获取Ai文件详情信息

ai_file_id
required
integer <int64> (ai文件训练得到的数据集id)

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "suggestion_list": [
    ],
  • "summary_mind_map": "由于我无法创建视觉图像,我将以Markdown格式提供文本形式的思维导图。以下是根据您提供的内容创建的思维导图:\n\n\n# 杭州交警提醒\n\n## 天气预警\n- 今晚强对流天气\n - 局部大暴雨\n - 雷雨大风\n- 白天多云到阴\n - 对出行影响不大\n- 后半夜到明天上午最强时段\n\n## 防范措施\n- 注意强对流天气防范\n- 15日天气恢复平静\n- 16日起雨水再次出现\n- 17-19日阵雨或雷雨增多\n\n## 驾车出行注意事项\n- 保证良好视线\n - 检查雨刷器\n - 除雾模式\n- 控制车速\n - 避免急刹\n- 转弯要慢\n - 避免急打方向\n- 减少超车、并线\n- 加大前后车距\n- 正确使用灯光\n- 积水路段要小心\n\n## 温馨提示\n1. 防范局地强降雨、雷雨大风\n2. 15日早晨能见度较低\n\n## 天气趋势预报\n- 14日(周日)\n - 上午阴有阵雨或雷雨\n - 下午到前半夜阴有时有阵雨或雷雨\n - 后半夜转阴到多云\n- 15日(周一)\n - 多云\n- 16日(周二)\n - 多云到阴,局部有阵雨或雷雨\n- 17日(周三)\n - 多云转阴有阵雨或雷雨\n- 18日(周四)\n - 阴有阵雨或雷雨\n- 19日(周五)\n - 阴有时有阵雨或雷雨\n\n## 发布信息\n- 杭州市气象台\n- 4月13日11时发布\n\n\n请注意,Markdown格式的思维导图在视觉上可能不如专业的思维导图软件直观,但它提供了一种结构化的方式来呈现信息。"
}

获取ai搜索推荐问题

Request Body schema: */*

获取ai搜索推荐问题参数

question
required
string (问题)

Responses

Response samples

Content type
application/json
{
  • "recommend_list": [
    ],
  • "success": true
}

获取知识号地址

Request Body schema: */*

知识号相关信息

knowledge_gpt_id
required
integer <int64> (知识员工id) >= 1

Responses

Response samples

Content type
application/json

查询知识员工详情

Request Body schema: */*

查询知识员工详情信息

knowledge_gpt_id
required
integer <int64> (知识员工id)

Responses

Response samples

Content type
application/json
{
  • "knowledge_gpt_id": 310,
  • "base_info": {
    },
  • "share_info": {},
  • "square_info": {
    }
}

获取知识号列表

Responses

Response samples

Content type
application/json
{
  • "Knowledge_gpt_list": [
    ],
  • "success": true
}

查询数据集列表

Responses

Response samples

Content type
application/json
{
  • "knowledge_data_list": [
    ]
}

查询数据集问答对列表

Request Body schema: */*

查询数据集问答对列表信息

data_id
required
integer <int64> (数据集id) >= 1
page_size
required
integer <int64> (页容量) >= 1
page_no
required
integer <int64> (页码) >= 1

Responses

Response samples

Content type
application/json
{
  • "qa_list": [
    ],
  • "total": 2,
  • "success": true
}

查询数据集知识片段列表

Request Body schema: */*

查询数据集知识片段列表信息

data_id
required
integer <int64> (数据集id) >= 1
page_size
required
integer <int64> (页容量) >= 1
page_no
required
integer <int64> (页码) >= 1

Responses

Response samples

Content type
application/json
{
  • "segment_list": [
    ],
  • "total": 1,
  • "success": true
}

查询训练任务详情列表

Request Body schema: */*

查询训练任务详情列表信息

data_id
required
integer <int64> (数据集id) >= 1
task_type
required
string (类型)
direct_segment(文件,直接分段)
csv_qa_import(CSV问答导入)
page_size
integer <int64> (页容量,不传默认为10) >= 1
page_num
integer <int64> (页码,从1开始,不传默认为1) >= 1

Responses

Response samples

Content type
application/json
{
  • "train_file_info": [
    ],
  • "total": 2,
  • "page_size": 10,
  • "page_num": 1
}

审阅管理

结束一个审阅

path Parameters
id
required
integer <int64>

审阅id

Responses

Response samples

Content type
application/json
{
  • "success": true
}

添加审阅

Request Body schema: */*

添加的审阅信息

file_ids
Array of integers <int64> (审阅的文件id列表) [ items <int64 > ]
title
string (审阅标题)
due_time
string (过期时间(xxxx-xx-xx,例如2021-10-09))
description
string (审阅描述)
invited_user_ids
Array of integers <int64> (被邀请审阅的人的用户id列表) [ items <int64 > ]

Responses

Response samples

Content type
application/json
{
  • "id": 123,
  • "name": "abc"
}

编辑审阅

path Parameters
id
required
integer <int64>

审阅id

Request Body schema: */*

修改的审阅信息

deleted_reviewers
Array of integers <int64> (删除审阅者) [ items <int64 > ]
added_reviewers
Array of integers <int64> (添加审阅者) [ items <int64 > ]
due_time
string (过期时间(xxxx-xx-xx,例如2021-10-09))

Responses

Response samples

Content type
application/json
{
  • "id": 576197,
  • "inviter": {
    },
  • "name": "123",
  • "description": "123",
  • "created_at": 1625564498,
  • "modified_at": 1625564500,
  • "due_time": 0,
  • "reviewers": [ ],
  • "items": [
    ],
  • "is_complete": true,
  • "need_sign": false,
  • "is_expired": true
}

获得审阅评论列表

path Parameters
id
required
integer <int64>

审阅id

query Parameters
page_id
required
integer <int32>

页码

page_capacity
required
integer <int32>

每页容量

Responses

Response samples

Content type
application/json
{
  • "review": {
    },
  • "review_comments": [
    ],
  • "review_comment_count": 1,
  • "total_count": 4,
  • "page_id": 0,
  • "page_capacity": 1,
  • "page_count": 4
}

获取审阅信息

path Parameters
id
required
integer <int64>

审阅id

Responses

Response samples

Content type
application/json
{
  • "id": 576197,
  • "inviter": {
    },
  • "name": "123",
  • "description": "123",
  • "created_at": 1625564498,
  • "modified_at": 1625564500,
  • "due_time": 0,
  • "reviewers": [ ],
  • "items": [
    ],
  • "is_complete": true,
  • "need_sign": false,
  • "is_expired": true
}

审阅评论管理

添加审阅评论

Request Body schema: */*

添加的审阅评论信息

content
required
string (审阅评论内容)
review_id
integer <int64> (审阅id)

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "id": 0,
  • "content": "string",
  • "review": {
    },
  • "created_at": 0,
  • "is_voice": true,
  • "voice_length": 0,
  • "voice_storage_path_mp3": "string",
  • "password_protected": "string",
  • "user": {
    }
}

删除审阅评论

path Parameters
id
required
integer <int64>

删除的审阅评论id

Responses

Response samples

Content type
application/json
{
  • "success": true
}

分享链接管理

获得分享链接信息

path Parameters
unique_name
required
string

分享标识符(分享链接最后面的唯一标识符)

query Parameters
password
string

分享链接密码,如果分享链接中有密码,则需要输入参数,否则不需要

Responses

Response samples

Content type
application/json
{
  • "unique_name": "322254d4ac9b0f17d252fd1284",
  • "access": "public",
  • "password_protected": true,
  • "created_at": 1625624483,
  • "modified_at": 1625624629,
  • "due_time": "2021-07-14",
  • "disable_download": false,
  • "download_count_total": 0,
  • "view_count": 1,
  • "preview_count": 0,
  • "item_version": 0,
  • "share_type": 0,
  • "share_category": 0,
  • "item": {
    },
  • "share_link_verification_code": "5c5bbd2aa1fead141bef93b72d690933"
}

获得分享链接详情信息

path Parameters
unique_name
required
string

分享标识符(分享链接最后面的唯一标识符)

Responses

Response samples

Content type
application/json
{
  • "unique_name": "322254d4ac9b0f17d252fd1284",
  • "access": "public",
  • "password_protected": true,
  • "created_at": 1625624483,
  • "expired": false,
  • "item": {
    },
  • "owner": {
    },
  • "due_time": "2021-07-14",
  • "success": true
}

文件标签管理

常用标签列表添加标签

Request Body schema: */*

添加常用标签信息

tag_names
required
Array of strings (常用标签名称列表)

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "common_tags": [
    ]
}

获取常用标签列表

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "common_tags": [
    ]
}

根据标签名称过滤项目

query Parameters
tag_name
required
string

标签名称

sort_by
required
string
Example: sort_by=name, date, size

排序方式

sort_direction
required
string
Example: sort_direction=desc, asc

排序顺序

page_id
required
integer <int32>

页码,从1开始

Responses

Response samples

Content type
application/json
{
  • "files": [
    ],
  • "folders": [ ],
  • "total_count": 2,
  • "page_id": 0,
  • "page_capacity": 20,
  • "page_count": 1
}

项目新增标签

Request Body schema: */*

需要添加的标签和项目信息

type
required
string (项目类型)

file:文件类型; folder:文件夹类型

id
required
string (项目id)

文件或者文件夹id

names
Array of strings (标签名称列表)

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "tags": [
    ]
}

项目移除标签

Request Body schema: */*

需要移除的标签和项目信息

type
required
string (项目类型)

file:文件类型; folder:文件夹类型

id
required
string (项目id)

文件或者文件夹id

tag_ids
required
Array of integers <int64> (标签id列表) [ items <int64 > ]

Responses

Response samples

Content type
application/json
{
  • "success": true
}

获取项目最近使用标签列表(最近十个)

Responses

Response samples

Content type
application/json
{
  • "success": true,
  • "my_tags": [
    ]
}

常用标签列表移出标签

Request Body schema: */*

移出常用标签列表

common_tag_ids
required
Array of integers <int64> (常用标签id列表) [ items <int64 > ]

Responses

Response samples

Content type
application/json
{
  • "success": true
}

回收站管理

清空回收站

Request Body schema: */*

清除类型

type
string (类型分为file,folder,all三种,不填写则默认为all)

Responses

Response samples

Content type
application/json
{
  • "success": true
}

恢复回收站

Request Body schema: */*

回收类型

type
string (类型分为file,folder,all三种,不填写则默认为all)

Responses

Response samples

Content type
application/json
{
  • "success": true
}

获取回收站列表

query Parameters
type
string

搜索类型,可选值: file, folder, all

sort_by
string

排序方式,可选值: name, date, size, score

sort_direction
string

排序顺序,可选值: desc, asc

page_id
integer <int32> >= 0

页码

page_capacity
integer <int32> >= 1
Default: 20

每页容量

Responses

Response samples

Content type
application/json
{
  • "files": [
    ],
  • "folders": [ ],
  • "total_count": 2,
  • "page_id": 0,
  • "page_capacity": 20,
  • "page_count": 1
}

用户管理

获取用户授权code

query Parameters
url
required
string

授权的url

Responses

Response samples

Content type
application/json
{
  • "code": "abc"
}

获取自己的信息

Responses

Response samples

Content type
application/json
{
  • "id": 449,
  • "enterprise": {
    },
  • "name": "qyang1",
  • "phone": "15088679770",
  • "email": "qyang1@admin.com",
  • "login": "qyang1@admin.com",
  • "profile_pic_key": "f2b7154b8fa0500004fa0cde46e5e214",
  • "active": true,
  • "full_name_pinyin": "qyang1",
  • "pinyin_first_letters": "qyang1"
}

获取用户直属部门

Responses

Response samples

Content type
application/json
{
  • "departments": [
    ]
}

获取用户信息

path Parameters
id
required
integer <int64>

用户id

Responses

Response samples

Content type
application/json
{
  • "id": 449,
  • "enterprise": {
    },
  • "name": "qyang1",
  • "phone": "15088679770",
  • "email": "qyang1@admin.com",
  • "login": "qyang1@admin.com",
  • "profile_pic_key": "f2b7154b8fa0500004fa0cde46e5e214",
  • "active": true,
  • "full_name_pinyin": "qyang1",
  • "pinyin_first_letters": "qyang1"
}

用户空间使用情况

Responses

Response samples

Content type
application/json
{
  • "space_used": "32.95 GB",
  • "space_total": "100.0 TB"
}

获取用户头像

该接口的返回结果是一个头像文件

path Parameters
id
required
integer <int64>

该用户的id

query Parameters
profile_pic_key
required

Responses

企业用户搜索

query Parameters
query_words
string

搜索关键字,默认企业所有用户

page_id
integer <int32> >= 0

页码,默认为0

Responses

Response samples

Content type
application/json
{
  • "users": [
    ],
  • "total_count": 4,
  • "page_id": 0,
  • "page_capacity": 500,
  • "page_count": 1
}

更新用户信息

Request Body schema: */*

用户更新的信息

name
required
string (新名字,长度不能超过30个字符)

Responses

Response samples

Content type
application/json
{
  • "id": 449,
  • "enterprise": {
    },
  • "name": "qyang1",
  • "phone": "15088679770",
  • "email": "qyang1@admin.com",
  • "login": "qyang1@admin.com",
  • "profile_pic_key": "f2b7154b8fa0500004fa0cde46e5e214",
  • "active": true,
  • "full_name_pinyin": "qyang1",
  • "pinyin_first_letters": "qyang1"
}

企业级部门管理

添加部门成员

path Parameters
id
required
integer <int64>

部门ID

Request Body schema: */*

添加的用户信息

user_id
required
integer <int64> (用户id) >= 1

Responses

Response samples

Content type
application/json
{
  • "success": true
}

创建部门

Request Body schema: */*

新部门的相关信息

name
required
string (部门名称,长度不能超过30个字符)
parent_id
required
integer <int64> (父部门id)
director_id
integer <int64> (部门管理员id) >= 1
Array of objects (特殊成员信息)
space_total
integer <int64> (总共空间,单位为GB,默认为20) >= 1
hide_phone
boolean (是否隐藏部门成员手机号,默认和上级部门保持一致)
disable_share
boolean (是否禁用分享,默认和上级部门保持一致)
enable_watermark
boolean (是否开启水印预览,默认和上级部门保持一致)
create_common_folder
boolean (是否建立公共资料库,默认false)
collab_auto_accepted
boolean (是否自动接受协作邀请,默认false)

Responses

Response samples

Content type
application/json
{
  • "director": {
    },
  • "space_used": 79152336,
  • "space_total": 21474836480,
  • "special_users": [ ],
  • "hide_phone": false,
  • "disable_share": false,
  • "enable_watermark": false,
  • "collab_auto_accepted": false,
  • "id": 65820,
  • "name": "亿方云测试",
  • "parent_id": 0,
  • "order": 1
}

删除部门

path Parameters
id
required
integer <int64>

部门ID

Responses

Response samples

Content type
application/json
{
  • "success": true
}

获取子部门列表

path Parameters
id
required
integer <int64>

部门ID

Responses

Response samples

Content type
application/json
{
  • "children": [
    ]
}

获取子部门空间列表

query Parameters
operator_id
required
integer <int32> >= 0

操作人user_id

Responses

Response samples

Content type
application/json
{
  • "department_list": [
    ]
}

获取部门的文件管理员信息

path Parameters
platform_id
required
integer <int64>

平台id,私有部署一般默认为:2

Request Body schema: */*

客户部门id列表

Array
string

Responses

Response samples

Content type
application/json
{
  • "department_file_manager_info_list": [
    ]
}

获取仅管理员可见的部门信息

path Parameters
id
required
integer <int64>

部门id

Responses

Response samples

Content type
application/json
{
  • "director": {
    },
  • "space_used": 79152336,
  • "space_total": 21474836480,
  • "special_users": [ ],
  • "hide_phone": false,
  • "disable_share": false,
  • "enable_watermark": false,
  • "collab_auto_accepted": false,
  • "id": 65820,
  • "name": "亿方云测试",
  • "parent_id": 0,
  • "order": 1
}

移除部门成员

path Parameters
id
required
integer <int64>

部门ID

Request Body schema: */*

移除的用户信息

user_id
required
integer <int64> (用户id) >= 1

Responses

Response samples

Content type
application/json
{
  • "success": true
}

修改部门

path Parameters
id
required
integer <int64>

部门id

Request Body schema: */*

部门的相关信息

name
required
string (部门名称,长度不能超过30个字符)
parent_id
integer <int64> (父部门id) >= 0
director_id
integer <int64> (部门管理员id) >= -1
Array of objects (特殊成员信息)
space_total
integer <int64> (总共空间,单位为GB,默认为20) >= 1
hide_phone
boolean (是否隐藏部门成员手机号,默认和上级部门保持一致)
disable_share
boolean (是否禁用分享,默认和上级部门保持一致)
enable_watermark
boolean (是否开启水印预览,默认和上级部门保持一致)
collab_auto_accepted
boolean (是否自动接受协作邀请,默认false)
file_managers
Array of integers <int64> (文件管理员id列表) [ items <int64 > ]
permission_type
string (部门权限)

Responses

Response samples

Content type
application/json
{
  • "director": {
    },
  • "space_used": 79152336,
  • "space_total": 21474836480,
  • "special_users": [ ],
  • "hide_phone": false,
  • "disable_share": false,
  • "enable_watermark": false,
  • "collab_auto_accepted": false,
  • "id": 65820,
  • "name": "亿方云测试",
  • "parent_id": 0,
  • "order": 1
}

修改部门空间大小

path Parameters
id
required
integer <int64>

部门id

Request Body schema: */*

部门的相关信息

operatorId
integer <int64> (操作者id) >= 0
spaceTotal
integer <int64> (部门总空间) >= 1

Responses

Response samples

Content type
application/json
{
  • "department": {
    }
}

获取详细的部门成员列表

path Parameters
id
required
integer <int64>

部门ID

query Parameters
query_words
string

查询关键字

page_id
integer <int32> >= 0

页码

Responses

Response samples

Content type
application/json
{
  • "users": [
    ],
  • "total_count": 4,
  • "page_id": 0,
  • "page_capacity": 500,
  • "page_count": 1
}

企业级群组管理

添加群组成员

path Parameters
id
required
integer <int64>

群组id

Request Body schema: */*

添加的用户信息

user_id
required
integer <int64> (用户id) >= 1

Responses

Response samples

Content type
application/json
{
  • "success": true
}

创建群组

Request Body schema: */*

新群组的相关信息

name
required
string (群组名称,长度不能超过30个字符)
admin_user_id
integer <int64> (群组管理员id,默认没有) >= 1
description
string (群组描述)
visible
boolean (是否可见,默认false)
collab_auto_accepted
boolean (是否自动接受协作邀请,默认false,当群组管理员为空时默认为true)

Responses

Response samples

Content type
application/json
{
  • "is_visible": true,
  • "collab_auto_accepted": true,
  • "id": 123,
  • "name": "autotest_Ldm_123",
  • "description": "",
  • "created_at": 1513102764,
  • "user_count": 0
}

删除群组

path Parameters
id
required
integer <int64>

群组id

Responses

Response samples

Content type
application/json
{
  • "success": true
}

获取公司可见群组

获取该公司的可见的群组列表

query Parameters
query_words
string

查询关键字

page_id
integer <int32> >= 0

页码

Responses

Response samples

Content type
application/json
{
  • "created_at": 1496992074,
  • "children_departments_count": 1,
  • "director": {
    },
  • "direct_item_count": 1,
  • "id": 65820,
  • "name": "xxx",
  • "user_count": 4,
  • "parent_id": 0,
  • "order": 1
}

获取仅管理员可见的部门信息

path Parameters
id
required
integer <int64>

群组id

Responses

Response samples

Content type
application/json
{
  • "is_visible": true,
  • "collab_auto_accepted": true,
  • "id": 123,
  • "name": "autotest_Ldm_123",
  • "description": "",
  • "created_at": 1513102764,
  • "user_count": 0
}

移除群组成员

path Parameters
id
required
integer <int64>

群组id

Request Body schema: */*

移除的用户信息

user_id
required
integer <int64> (用户id) >= 1

Responses

Response samples

Content type
application/json
{
  • "success": true
}

修改群组

path Parameters
id
required
integer <int64>

群组id

Request Body schema: */*

群组的相关信息

name
string (群组名称,长度不能超过30个字符)
admin_user_id
integer <int64> (群组管理员id,默认没有) >= -1
description
string (群组描述)
visible
boolean (是否可见,默认false)
collab_auto_accepted
boolean (是否自动接受协作邀请,默认false,当群组管理员为空时默认为true)

Responses

Response samples

Content type
application/json
{
  • "is_visible": true,
  • "collab_auto_accepted": true,
  • "id": 123,
  • "name": "autotest_Ldm_123",
  • "description": "",
  • "created_at": 1513102764,
  • "user_count": 0
}

获取群组成员列表

path Parameters
id
required
integer <int64>

群组id

query Parameters
query_words
string

查询关键字

page_id
integer <int32> >= 0

页码

Responses

Response samples

Content type
application/json
{
  • "users": [
    ],
  • "total_count": 4,
  • "page_id": 0,
  • "page_capacity": 500,
  • "page_count": 1
}

企业级日志管理

获取日志操作类型信息

Request Body schema: */*

操作类型信息

action_types
Array of integers <int64> (日志操作类型) [ items <int64 > ]
is_all
boolean

Responses

Response samples

Content type
application/json
{
  • "action_types": {
    }
}

获取日志信息

Request Body schema: */*

日志信息

start_date
required
string (起始时间,格式为:yyyy-MM-dd, 不得早于今日前90天)
end_date
required
string (截止时间,格式为:yyyy-MM-dd, 不得迟于今日)
page_number
integer <int64> (页数)
page_size
integer <int64> (页容量)
action_types
Array of integers <int64> (日志类型) [ items <int64 > ]
file_ids
Array of integers <int64> (文件id列表) [ items <int64 > ]
folder_ids
Array of integers <int64> (文件夹id列表) [ items <int64 > ]
review_ids
Array of integers <int64> (审阅id列表) [ items <int64 > ]
emails
Array of strings (邮箱列表)
folder_collection_ids
Array of integers <int64> (文件夹手机手机列表) [ items <int64 > ]
department_ids
Array of integers <int64> (部门id列表) [ items <int64 > ]
user_ids
Array of integers <int64> (用户id列表) [ items <int64 > ]

Responses

Response samples

Content type
application/json
{
  • "total_count": 2,
  • "user_activities": [
    ],
  • "success": true
}

获取日志信息列表

Request Body schema: */*

日志信息

start_date
required
string (起始时间,格式为:yyyy-MM-dd, 不得早于今日前90天)
end_date
required
string (截止时间,格式为:yyyy-MM-dd, 不得迟于今日)
page_id
integer <int64> (页码,默认为1)
page_capacity
integer <int64> (页容量,默认为25,不超过500)

Responses

Response samples

Content type
application/json
{
  • "user_activities": [
    ],
  • "success": true
}

分页获取日志信息

Request Body schema: */*

日志信息

date
required
string (日期,格式为:yyyy-MM-dd)
pagination
integer <int64> (页容量)
page_capacity
integer <int64> (页码数)

Responses

Response samples

Content type
application/json
{
  • "pagination": 1,
  • "user_activities": [
    ],
  • "success": true
}

企业级第三方平台管理

获取关联部门

path Parameters
id
required
integer <int64>

平台id,私有部署一般默认为:2

query Parameters
department_id
required
string

部门个性化id

yfy_department_id
required
integer <int64>

亿方云平台上的部门id

Responses

Response samples

Content type
application/json
{
  • "custom_id": "xxx",
  • "director": {
    },
  • "space_used": 79152336,
  • "space_total": 21474836480,
  • "special_users": [ ],
  • "hide_phone": false,
  • "disable_share": false,
  • "enable_watermark": false,
  • "collab_auto_accepted": false,
  • "id": 65820,
  • "name": "亿方云测试",
  • "parent_id": 0,
  • "order": 1
}

获取关联群组

path Parameters
id
required
integer <int64>

平台id,私有部署一般默认为:2

query Parameters
group_id
required
string

群组个性化id

yfy_group_id
required
integer <int64>

亿方云平台上的群组id

Responses

Response samples

Content type
application/json
{
  • "custom_id": "xxx",
  • "is_visible": true,
  • "collab_auto_accepted": true,
  • "id": 157290,
  • "name": "autotest_Ldm_1513102763",
  • "description": "",
  • "created_at": 1513102764,
  • "user_count": 0
}

获取关联用户

user_id和yfy_user_id两个参数二选一,若都传则使用user_id

path Parameters
id
required
integer <int64>

平台id,私有部署一般默认为:2

query Parameters
user_id
required
string

用户个性化id

yfy_user_id
required
integer <int64>

亿方云平台上的用户id

Responses

Response samples

Content type
application/json
{
  • "custom_id": "xxx",
  • "hide_phone": false,
  • "disable_download": false,
  • "space_used": 14481,
  • "space_total": 21474836480,
  • "id": 881525,
  • "name": "xxx",
  • "login": "xxx@xxx.com",
  • "phone": "11111111111",
  • "email": "xxx@xxx.com",
  • "profile_pic_key": "ee1bacaffb0128a26b51afaf17126a8b",
  • "active": true,
  • "full_name_pinyin": "xxx",
  • "pinyin_first_letters": "xxx"
}

批量同步部门

path Parameters
id
required
integer <int64>

平台id,私有部署一般默认为:2

Request Body schema: */*

部门的同步信息

required
Array of objects (同步的部门信息)

Responses

Response samples

Content type
application/json
{
  • "success_items_count": 1,
  • "request_id": "sadasdsd-fgewrsecd-sdfsdwer-sddsf"
}

批量同步群组

path Parameters
id
required
integer <int64>

平台id,私有部署一般默认为:2

Request Body schema: */*

群组的同步信息

required
Array of objects (同步的群组信息)

Responses

Response samples

Content type
application/json
{
  • "success_items_count": 1,
  • "request_id": "sadasdsd-fgewrsecd-sdfsdwer-sddsf"
}

批量同步用户

path Parameters
id
required
integer <int64>

平台id,私有部署一般默认为:2

Request Body schema: */*

用户的同步信息

required
Array of objects (同步的用户信息)
default_department_id
string (默认加入的部门id)
default_group_id
string (默认加入的群组id)
custom_password
string (同步用户登录account密码)

Responses

Response samples

Content type
application/json
{
  • "success_items_count": 1,
  • "request_id": "sadasdsd-fgewrsecd-sdfsdwer-sddsf"
}

企业级用户管理

绑定第三方账号

path Parameters
id
required
integer <int64>

用户ID

Request Body schema: */*

第三方账号相关信息

id
string (用户id)
name
string (用户名)
avatar
string (用户头像)
credentialType
integer <int32> (第三方账号类型)

Responses

Response samples

Content type
application/json
{
  • "success": true
}

创建用户

Request Body schema: */*

新用户的相关信息

phone
string (用户手机)
email
string (用户邮箱)
storage_id
integer <int64> (用户存储id,非多存储不需要关心)
space_total
integer <int64> (用户空间大小,-1为无限,单位为GB)
hide_phone
boolean (是否隐藏手机号,默认为false)
disable_download
boolean (是否禁用下载,默认为false)
force_active
boolean (是否强制激活,默认为false)
password
string (当force_active为true时,必须提供并且长度在6-32位之间,false时忽略该参数)

Responses

Response samples

Content type
application/json
{
  • "hide_phone": false,
  • "disable_download": false,
  • "space_used": 14481,
  • "space_total": 21474836480,
  • "id": 881525,
  • "name": "xxx",
  • "login": "xxx@xxx.com",
  • "phone": "11111111111",
  • "email": "xxx@xxx.com",
  • "profile_pic_key": "ee1bacaffb0128a26b51afaf17126a8b",
  • "active": true,
  • "full_name_pinyin": "xxx",
  • "pinyin_first_letters": "xxx"
}

删除用户

path Parameters
id
required
integer <int64>

用户ID

Request Body schema: */*

转交文件的用户

user_receive_items
required
integer <int64> (接收文件的用户id) >= 1

Responses

Response samples

Content type
application/json
{
  • "success": true
}

获取用户登录参数

query Parameters
identifier
required
string

用户标识

type
required
string
Example: type=simple_phone_or_email(手机号或者邮箱), user_ticket(个性化用户id)

用户标识类型

platform_id
required
integer <int64> >= 1

平台id,私有部署一般默认为:2

Responses

Response samples

Content type
application/json
{
  • "auth_key": "ejqeobGoeT",
  • "client_id": "e885b1d0-39e4-49eb-be06-16078cf3f613",
  • "expires_in": 300
}

获取用户登录链接

query Parameters
identifier
required
string

用户标识

type
required
string
Example: type=simple_phone_or_email(手机号或者邮箱), user_ticket(个性化用户id)

用户标识类型

platform_id
required
integer <int64> >= 1

平台id,私有部署一般默认为:2

Responses

Response samples

Content type
application/json

获取用户信息

query Parameters
identifier
required
string

用户标识

type
required
string
Example: type=simple_phone_or_email(手机号或者邮箱), user_ticket(个性化用户id)

用户标识类型

platform_id
required
integer <int64> >= 1

平台id,私有部署一般默认为:2

Responses

Response samples

Content type
application/json
{
  • "id": 449,
  • "enterprise": {
    },
  • "name": "qyang1",
  • "phone": "15088679770",
  • "email": "qyang1@admin.com",
  • "login": "qyang1@admin.com",
  • "profile_pic_key": "f2b7154b8fa0500004fa0cde46e5e214",
  • "active": true,
  • "full_name_pinyin": "qyang1",
  • "pinyin_first_letters": "qyang1"
}

获取仅管理员可见的用户信息

path Parameters
id
required
integer <int64>

用户id

query Parameters
last_login_flag
boolean

是否查询用户最后登录时间

Responses

Response samples

Content type
application/json
{
  • "hide_phone": false,
  • "disable_download": false,
  • "space_used": 14481,
  • "space_total": 21474836480,
  • "id": 881525,
  • "name": "xxx",
  • "login": "xxx@xxx.com",
  • "phone": "11111111111",
  • "email": "xxx@xxx.com",
  • "profile_pic_key": "ee1bacaffb0128a26b51afaf17126a8b",
  • "active": true,
  • "full_name_pinyin": "xxx",
  • "pinyin_first_letters": "xxx"
}

修改用户

path Parameters
id
required
integer <int64>

用户ID

Request Body schema: */*

用户的相关信息

name
string (用户名称,长度不能超过30个字符)
storage_id
integer <int64> (用户存储id,非多存储不需要关心)
space_total
integer <int64> (用户空间大小,-1为无限,单位为GB)
hide_phone
boolean (是否隐藏手机号,默认为false)
disable_download
boolean (是否禁用下载,默认为false)

Responses

Response samples

Content type
application/json
{
  • "hide_phone": false,
  • "disable_download": false,
  • "space_used": 14481,
  • "space_total": 21474836480,
  • "id": 881525,
  • "name": "xxx",
  • "login": "xxx@xxx.com",
  • "phone": "11111111111",
  • "email": "xxx@xxx.com",
  • "profile_pic_key": "ee1bacaffb0128a26b51afaf17126a8b",
  • "active": true,
  • "full_name_pinyin": "xxx",
  • "pinyin_first_letters": "xxx"
}