Web API V2.1

Web API (For Seafile server v5.1.0+)

Seafile Web APIAPI BasicsStatus CodeQuick Start AccountCheck Account InfoGet Client Login URLGet Server Information Starred FilesList starred filesStar A FileUnstar A File GroupList GroupsAdd a GroupGet Info of a GroupRename a GroupTransfer a GroupDelete a GroupQuit Group Group MemberList Group MembersAdd a Group MemberBulk Add Group MembersGet Info of a Group MemberSet a Group Member AdminUnset a Group Member AdminDelete a Group Member Group MessageGet Group MessagesSend A Group MessageDelete A Group Message Share Share LinkList all Share LinksList Share Links of a LibraryList Share Link of a Folder(File)Create Share LinkDelete Share LinkSend Share Link EmailList Direntry in Dir Download Link Upload LinkList Upload LinksCreate Upload LinkDelete Upload LinkSend Upload Link Email Shared LibrariesList User Shared LibrariesList Group Shared LibrariesList Be Shared LibrariesDelete Be Shared LibraryShare a Library to UserUnshare a Library from UserUpdate Permission of User Shared LibraryShare a Library to GroupUnshare a Library from GroupUpdate Permission of Group Shared LibraryBatch Share Libraries to UserBatch Share Libraries to Group Shared FoldersShare A FolderList Shared FoldersUpdate Shared Folder PermissionUnshare A Folder Folder Permission User Folder PermissionGet User Folder PermissionSet User Folder PermissionModify User Folder PermissionDelete User Folder Permission Group Folder PermissionGet Group Folder PermissionSet Group Folder PermissionModify Group Folder PermissionDelete Group Folder Permission LibraryGet Default LibraryCreate Default LibraryList LibrariesGet Library InfoGet Library OwnerGet Library HistoryGet Library History Limit DaysSet Library History Limit DaysCreate LibraryCheck/Create Sub LibraryDelete LibraryRename LibraryTransfer LibraryDecrypt LibraryCreate Public LibrarySet Exist Lib as Public LibraryRemove Public LibraryFetch library download infoSearch Files in LibrariesGet Library Download LinksGet Library Upload LinksDelete Library Download LinkDelete Library Upload LinkSearch Library By Name FileView File Through OwaDownload FileGet File DetailGet File HistoryRestore File From HistoryDownload File From a RevisionCreate FileRename FileLock FileUnlock FileMove FileCopy FileRevert FileDelete File Upload FileGet Upload LinkUpload File Resumable Upload FileCheck If Enable Resumable UploadGet Upload LinkGet Bytes Already UploadedUpload File Update FileGet Update LinkUpdate FileUploading Large File in BlocksGet Update Blocks Link File CommentGet CommentDelete CommentList CommentsPost CommentsGet Number of Comments DirectoryList Directory EntriesGet Directory DetailCreate New DirectoryRename DirectoryDelete DirectoryDownload DirectoryRevert Directory Asynchronously Copy/Move File/DirectoryGet Task IdCancel TaskQuery Progress Multiple Files / DirectoriesCopyMoveDeleteDownload AvatarUpdate User AvatarGet User AvatarGet Group Avatar DevicesGet User DevicesUnlink User Device Snapshot LabelGet Snapshot LabelCreate New Snapshot LabelUpdate Snapshot LabelDelete Snapshot LabelGet File ActivitiesGet Thumbnail ImageSearch User Admin Only AccountList AccountsGet Account InfoCreate AccountUpdate AccountMigrate AccountDelete Account DevicesGet Desktop DevicesGet Mobile DevicesUnlink User DeviceGet Device ErrorsClean Device Errors Get Snapshots by Label Default LibraryGet User Default LibraryCreate User Default Library LibrairiesGet all LibrariesSearch Library by NameSearch Library by OwnerDelete a LibraryTransfer a LibraryGet Library DirentsGet All Deleted LibrariesGet Deleted Libraries by OwnerClean Deleted LibraryRestore Deleted LibraryClean ALl Deleted Libraries SharesGet Repo User SharesGet Repo Group SharesShare Repo to UserShare Repo to GroupModify Repo User Share PermissionModify Repo Group Share PermissionDelete Repo User ShareDelete Repo Group Share GroupsGet all GroupsDelete a GroupTransfer a GroupGet Group LibrariesDelete Group LibraryGet Group MembersDelete Group MemberAdd Group MemberUpdate Group Member Role Shared Links Download LinksGet Shared File/Dir InfoGet Sub File/Dir List in Shared DirDownload File/DirCheck Password Upload LinksGet Shared Dir InfoUpload FileCheck Password LogGet Login LogGet File Audit LogGet File Update LogGet Permission Audit Log OrganizationAdd OrganizationAdd Organization UserGet Organization User InfoUpdate Organization User InfoDelete Organization User DepartmentList departmentsList groups and members in a departmentCreate departmentDismiss department

Seafile Web API

API Basics

All API calls must be authenticated with a valid Seafile API key.

curl -H 'Authorization: Token 24fd3c026886e3121b2ca630805ed425c272cb96' https://cloud.seafile.com/api2/auth/ping/

The api key can be retrieved by the obtain auth api. See the Quick Start for details.

For each API, we provide curl examples to illustrate the usage. We also provide python and javascript examples, please refer to https://github.com/haiwen/webapi-examples for details.

Status Code

  • 200: OK

  • 201: CREATED

  • 202: ACCEPTED

  • 301: MOVED_PERMANENTLY

  • 400: BAD_REQUEST

  • 403: FORBIDDEN

  • 404: NOT_FOUND

  • 409: CONFLICT

  • 429: TOO_MANY_REQUESTS

  • 440: REPO_PASSWD_REQUIRED

  • 441: REPO_PASSWD_MAGIC_REQUIRED

  • 500: INTERNAL_SERVER_ERROR

  • 520: OPERATION_FAILED

Quick Start

ping

curl https://cloud.seafile.com/api2/ping/
"pong"

obtain auth token

curl -d "[email protected]&password=123456" https://cloud.seafile.com/api2/auth-token/
{"token": "24fd3c026886e3121b2ca630805ed425c272cb96"}

you should use --data-urlencode if you want to process some special characters properly.

curl --data-urlencode [email protected] -d password=123456 https://cloud.seafile.com/api2/auth-token/
{"token":"265757b0a5aaf5d6b2e266d0c21791121ce6cdec"}

auth ping

curl -H 'Authorization: Token 24fd3c026886e3121b2ca630805ed425c272cb96' https://cloud.seafile.com/api2/auth/ping/
"pong"

Account

Check Account Info

GET https://cloud.seafile.com/api2/account/info/

Sample request

curl -H "Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd" -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/account/info/

Sample response

{
"usage": 26038531,
"total": 104857600,
}

Errors

  • 403 Invalid token

Get Client Login URL

GET https://cloud.seafile.com/api2/client-login/

Sample request

curl -H "Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd" https://cloud.seafile.com/api2/client-login/

Sample response

Note:

  • If the user has two way authentication enabled, the server will respond with an empty JSON object ({}).

"https://cloud.seafile.com/client-login/?token=000f1f83d612836c65fed087fb9c4ca40852d0f9"

Errors

  • 403 Invalid token

Get Server Information

GET https://cloud.seafile.com/api2/server-info

Note:

  • No authentication required.

  • Added in seafile community edition server 4.0.5 or pro edition server 4.0.3

Sample request

curl https://cloud.seafile.com/api2/server-info/

Sample response

Sample response from a seafile community edition server:

{
"version": "4.0.6",
"features": [
"seafile-basic",
]
}

Sample response from a seafile pro edition server:

{
"version": "4.0.6",
"features": [
"seafile-basic",
"seafile-pro",
"office-preview",
"file-search"
]
}

Starred Files

List starred files

GET https://cloud.seafile.com/api2/starredfiles/

Sample request

curl -H "Authorization: Token f2210dacd9c6ccb8133606d94ff8e6199b477fd" -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/starredfiles/

Sample response

[
{
"repo": "99b758e6-91ab-4265-b705-925367374cf0",
"mtime": 1355198150,
"org": -1,
"path": "/foo/bar.doc",
"dir": false,
"size": 0
},
{
"repo": "99b758e6-91ab-4265-b705-925367374cf0",
"mtime": 1353751237,
"org": -1,
"path": "/add_folder-blue.png",
"dir": false,
"size": 3170
}
]

Star A File

POST https://cloud.seafile.com/api2/starredfiles/

Request parameters

  • repo_id (post)

  • p (post)

Sample request

curl -v -d "repo_id=dae8cecc-2359-4d33-aa42-01b7846c4b32&p=/foo.md" -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' -H 'Accept: application/json; charset=utf-8; indent=4' https://cloud.seafile.com/api2/starredfiles/

Sample response

...
< HTTP/1.0 201 CREATED
< Location: https://cloud.seafile.com/api2/starredfiles/
...
"success"

Success

Response code is 201(Created) and Location header provides url of starred file list.

Errors

  • 400 repo_id or p is missing, or p is not valid file path(e.g. /foo/bar/).

Unstar A File

DELETE https://cloud.seafile.com/api2/starredfiles/

Request parameters

  • repo_id

  • p

Sample request

curl -X DELETE -v -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' -H 'Accept: application/json; charset=utf-8; indent=4' 'https://cloud.seafile.com/api2/starredfiles/?repo_id=dae8cecc-2359-4d33-aa42-01b7846c4b32&p=/foo.md'

Sample response

...
< HTTP/1.0 200 OK
...
"success"

Success

Response code is 200(OK), and a string named "success" is returned.

Errors

  • 400 repo_id or p is missing, or p is not valid file path(e.g. /foo/bar/).

Group

List Groups

GET https://cloud.seafile.com/api2/groups/

Sample request

curl -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' "https://cloud.seafile.com/api2/groups/"

Sample response

{
"replynum": 0,
"groups": [
{
"ctime": 1398134171327948,
"creator": "[email protected]",
"msgnum": 0,
"mtime": 1398231100,
"id": 1,
"name": "lian"
},
{
"ctime": 1398236081042441,
"creator": "[email protected]",
"msgnum": 0,
"mtime": 0,
"id": 2,
"name": "123"
}
]
}

Add a Group

POST https://cloud.seafile.com/api/v2.1/groups/

Request parameters

  • name (name of new group)

Sample request

curl -d "name=new_group_name" -H 'Authorization: Token 444d2bbf1fc78ffbeedc4704c9f41e32d926ac94' https://cloud.seafile.com/api/v2.1/groups/

Sample response

{
"name": "new_group_name",
"owner": "[email protected]",
"created_at": "2015-12-17T10:29:57+0800",
"admins": ["[email protected]"],
"avatar_url": "https://cloud.seafile.com/media/avatars/groups/default.png",
"id": 773
}

Get Info of a Group

GET https://cloud.seafile.com/api/v2.1/groups/772/

Request parameters

  • avatar_size

  • with_repos (0 or 1, if return library info of group. default 0 not return)

Sample request

curl -H 'Authorization: Token 444d2bbf1fc78ffbeedc4704c9f41e32d926ac94' https://cloud.seafile.com/api/v2.1/groups/772/

Sample response

{
"name": "rename_group_name",
"owner": "[email protected]",
"created_at": "2015-12-17T10:29:57+0800",
"admins": ["[email protected]"],
"avatar_url": "https://cloud.seafile.com/media/avatars/groups/default.png",
"id": 772
}

Rename a Group

PUT https://cloud.seafile.com/api/v2.1/groups/772/

Request parameters

  • name (name of new group)

Sample request

curl -X PUT -d "name=rename_group_name" -H 'Authorization: Token 444d2bbf1fc78ffbeedc4704c9f41e32d926ac94' https://cloud.seafile.com/api/v2.1/groups/772/

Sample response

{
"name": "rename_group_name",
"owner": "[email protected]",
"created_at": "2015-12-17T10:29:57+0800",
"admins": ["[email protected]"],
"avatar_url": "https://cloud.seafile.com/media/avatars/groups/default.png",
"id": 772
}

Transfer a Group

PUT https://cloud.seafile.com/api/v2.1/groups/772/

Request parameters

  • owner (new owner of this group, should be an email.)

Sample request

curl -X PUT -d "[email protected]_owner.com" -H 'Authorization: Token 444d2bbf1fc78ffbeedc4704c9f41e32d926ac94' https://cloud.seafile.com/api/v2.1/groups/772/

Sample response

{
"name": "rename_group_name",
"owner": "[email protected]_owner.com",
"created_at": "2015-12-17T10:29:57+0800",
"admins": ["[email protected]", "[email protected]_owner.com"],
"avatar_url": "https://cloud.seafile.com/media/avatars/groups/default.png",
"id": 772
}

Delete a Group

DELETE https://cloud.seafile.com/api/v2.1/groups/772/

Sample request

curl -X DELETE -H 'Authorization: Token 444d2bbf1fc78ffbeedc4704c9f41e32d926ac94' https://cloud.seafile.com/api/v2.1/groups/772/

Sample response

{"success":true}

Quit Group

DELETE https://cloud.seafile.com/api/v2.1/groups/770/members/[email protected]/

Sample request

curl -X DELETE -H 'Authorization: Token 444d2bbf1fc78ffbeedc4704c9f41e32d926ac94' https://cloud.seafile.com/api/v2.1/groups/770/members/[email protected]/

Sample response

{"success":true}

Group Member

List All Group Members

GET https://cloud.seafile.com/api/v2.1/groups/770/members/

Request parameters

  • avatar_size

  • is_admin (true or false, if ONLY return admin members of group. default false return all members)

Sample request

curl -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' "https://cloud.seafile.com/api/v2.1/groups/770/members/"

Sample response

[
{
"login_id": "",
"name": "nickname-of-lian",
"avatar_url": "https://cloud.seafile.com/media/avatars/default.png",
"is_admin": true,
"contact_email": "[email protected]",
"email": "[email protected]"
},
{
"login_id": "",
"name": "1",
"avatar_url": "https://cloud.seafile.com/media/avatars/default.png",
"is_admin": false,
"contact_email": "[email protected]",
"email": "[email protected]"
}
]

Add a Group Member

POST https://cloud.seafile.com/api/v2.1/groups/770/members/

Request parameters

  • email

Sample request

curl -d "[email protected]" -H 'Authorization: Token 444d2bbf1fc78ffbeedc4704c9f41e32d926ac94' https://cloud.seafile.com/api/v2.1/groups/770/members/

Sample response

{
"login_id": "",
"name": "new-member",
"avatar_url": "https://cloud.seafile.com/media/avatars/default.png",
"is_admin": false,
"contact_email": "[email protected]",
"email": "[email protected]"
}

Bulk Add Group Members

POST https://cloud.seafile.com/api/v2.1/groups/770/members/bulk/

Request parameters

  • emails

Sample request

curl -d "[email protected],[email protected],[email protected]" -H 'Authorization: Token 444d2bbf1fc78ffbeedc4704c9f41e32d926ac94' https://cloud.seafile.com/api/v2.1/groups/770/members/bulk/

Sample response

{
"failed":[
{
"error_msg": "Invalid email",
"email": "[email protected]"
},
{
"error_msg": "Is already group member",
"email": "[email protected]"
}
"success":[
{
"login_id": "",
"name": "new-member-1",
"avatar_url": "https://cloud.seafile.com/media/avatars/default.png",
"is_admin": false,
"contact_email": "[email protected]",
"email": "[email protected]"
},
{
"login_id": "",
"name": "new-member-2",
"avatar_url": "https://cloud.seafile.com/media/avatars/default.png",
"is_admin": false,
"contact_email": "[email protected]",
"email": "[email protected]"
}
]
}

Get Info of a Group Member

GET https://cloud.seafile.com/api/v2.1/groups/770/members/[email protected]/

Sample request

curl -H 'Authorization: Token 444d2bbf1fc78ffbeedc4704c9f41e32d926ac94' https://cloud.seafile.com/api/v2.1/groups/770/members/[email protected]/

Request parameters

  • avatar_size

Sample response

{
"login_id": "",
"name": "group-member",
"avatar_url": "https://cloud.seafile.com/media/avatars/default.png",
"is_admin": false,
"contact_email": "[email protected]",
"email": "[email protected]"
}

Set a Group Member Admin

PUT https://cloud.seafile.com/api/v2.1/groups/770/members/[email protected]/

Request parameters

  • is_admin=true

Sample request

curl -X PUT -d "is_admin=true" -H 'Authorization: Token 444d2bbf1fc78ffbeedc4704c9f41e32d926ac94' https://cloud.seafile.com/api/v2.1/groups/770/members/[email protected]/

Sample response

{
"login_id": "",
"name": "group-member",
"avatar_url": "https://cloud.seafile.com/media/avatars/default.png",
"is_admin": true,
"contact_email": "[email protected]",
"email": "[email protected]"
}

Unset a Group Member Admin

PUT https://cloud.seafile.com/api/v2.1/groups/770/members/[email protected]/

Request parameters

  • is_admin=false

Sample request

curl -X PUT -d "is_admin=false" -H 'Authorization: Token 444d2bbf1fc78ffbeedc4704c9f41e32d926ac94' https://cloud.seafile.com/api/v2.1/groups/770/members/[email protected]/

Sample response

{
"login_id": "",
"name": "group-member",
"avatar_url": "https://cloud.seafile.com/media/avatars/default.png",
"is_admin": false,
"contact_email": "[email protected]",
"email": "[email protected]"
}

Delete a Group Member

DELETE https://cloud.seafile.com/api/v2.1/groups/770/members/[email protected]/

Sample request

curl -X DELETE -H 'Authorization: Token 444d2bbf1fc78ffbeedc4704c9f41e32d926ac94' https://cloud.seafile.com/api/v2.1/groups/770/members/[email protected]/

Sample response

{"success":true}

Group Message

Get Group Messages

GET https://cloud.seafile.com/api2/groups/{group_id}/discussions/

Request parameters

  • group_id

  • page (default 1)

  • per_page (default 20)

  • avatar_size (default 80)

Sample request

curl -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' "https://cloud.seafile.com/api2/groups/772/discussions/"

Sample response

{'current_page': 1,
'msgs': [{'avatar_url': 'https://cloud.seafile.com/media/avatars/default.png',
'content': u'test',
'created_at': '2016-07-11T09:18:20+08:00',
'group_id': 772,
'id': 1,
'user_email': u'[email protected]',
'user_login_id': '',
'user_name': u'name-of-lian'}],
'page_num': 1}

Send A Group Message

POST https://cloud.seafile.com/api2/groups/{group_id}/discussions/

Request parameters

  • group_id

  • content

  • avatar_size (default 80)

Sample request

curl -d "content=this is another test" -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' "https://cloud.seafile.com/api2/groups/772/discussions/"

Sample response

{'avatar_url': 'https://cloud.seafile.com/media/avatars/default.png',
'content': u'this is another test',
'created_at': '2016-07-11T09:27:49+08:00',
'group_id': 772,
'id': 3,
'user_email': u'[email protected]',
'user_login_id': '',
'user_name': u'name-of-lian'}

Delete A Group Message

DELETE https://cloud.seafile.com/api2/groups/772/discussions/3/

Request parameters

  • group_id

  • discuss_id

Sample request

curl -v -X DELETE -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' "https://cloud.seafile.com/api2/groups/772/discussions/3/"

sample response

...
< http/1.0 204 no content
...

Errors

  • 400 Discussion id not found.

  • 403 Permission denied.

Share

List all Share Links

This api will list all folder/file download share links in all libraries created by user.

GET https://cloud.seafile.com/api/v2.1/share-links/

Sample request

curl -H 'Authorization: Token 0eb24ce5db35a31f70171eca2f760f03f59fa09a' -H 'Accept: application/json; charset=utf-8; indent=4' "https://cloud.seafile.com/api/v2.1/share-links/"

Sample response

[
{
"username": "[email protected]",
"repo_id": "c474a093-19dc-4ddf-b0b0-72b33214ba33",
"ctime": "2017-04-01T02:35:57+00:00",
"expire_date": "",
"token": "6afa667ff2c248378b70",
"view_cnt": 0,
"link": "https://cloud.seafile.com/d/6afa667ff2c248378b70/",
"obj_name": "/",
"path": "/",
"is_dir": true,
"is_expired": false,
"repo_name": "seacloud.cc.124"
},
{
"username": "[email protected]",
"repo_id": "104f6537-b3a5-4d42-b8b5-8e47e494e4cf",
"ctime": "2017-04-01T02:35:29+00:00",
"expire_date": "",
"token": "0c4eb0cb104a43caaeef",
"view_cnt": 0,
"link": "https://cloud.seafile.com/d/0c4eb0cb104a43caaeef/",
"obj_name": "folder",
"path": "/folder/",
"is_dir": true,
"is_expired": false,
"repo_name": "for-test-web-api"
},
{
"username": "[email protected]",
"repo_id": "104f6537-b3a5-4d42-b8b5-8e47e494e4cf",
"ctime": "2017-04-01T02:35:35+00:00",
"expire_date": "",
"token": "8c05a00c44db4764b3a5",
"view_cnt": 0,
"link": "https://cloud.seafile.com/f/8c05a00c44db4764b3a5/",
"obj_name": "tmp.md",
"path": "/tmp.md",
"is_dir": false,
"is_expired": false,
"repo_name": "for-test-web-api"
}
]

Errors

  • 403 Permission denied.

  • 500 Internal Server Error

List Share Links of a Library

This api will list all folder/file download share links in a specific library.

GET https://cloud.seafile.com/api/v2.1/share-links/?repo_id={repo_id}

Request parameters

  • repo-id

Sample request

curl -H 'Authorization: Token 0eb24ce5db35a31f70171eca2f760f03f59fa09a' -H 'Accept: application/json; charset=utf-8; indent=4' "https://cloud.seafile.com/api/v2.1/share-links/?repo_id=104f6537-b3a5-4d42-b8b5-8e47e494e4cf"

Sample response

[
{
"username": "[email protected]",
"repo_id": "104f6537-b3a5-4d42-b8b5-8e47e494e4cf",
"ctime": "2017-04-01T02:35:29+00:00",
"expire_date": "",
"token": "0c4eb0cb104a43caaeef",
"view_cnt": 0,
"link": "https://cloud.seafile.com/d/0c4eb0cb104a43caaeef/",
"obj_name": "folder",
"path": "/folder/",
"is_dir": true,
"is_expired": false,
"repo_name": "for-test-web-api"
},
{
"username": "[email protected]",
"repo_id": "104f6537-b3a5-4d42-b8b5-8e47e494e4cf",
"ctime": "2017-04-01T02:35:35+00:00",
"expire_date": "",
"token": "8c05a00c44db4764b3a5",
"view_cnt": 0,
"link": "https://cloud.seafile.com/f/8c05a00c44db4764b3a5/",
"obj_name": "tmp.md",
"path": "/tmp.md",
"is_dir": false,
"is_expired": false,
"repo_name": "for-test-web-api"
}
]

Errors

  • 403 Permission denied.

  • 404 library not found.

  • 500 Internal Server Error

List Share Link of a Folder(File)

This api will list download share link info of a specific folder/file.

GET https://cloud.seafile.com/api/v2.1/share-links/?repo_id={rpeo_id}&path={path}

Request parameters

  • repo-id

  • path, could be path of a foler or a file.

Sample request

Get folder download share link.

curl -H 'Authorization: Token 0eb24ce5db35a31f70171eca2f760f03f59fa09a' -H 'Accept: application/json; charset=utf-8; indent=4' "https://cloud.seafile.com/api/v2.1/share-links/?repo_id=104f6537-b3a5-4d42-b8b5-8e47e494e4cf&path=/folder/"

Sample response

[
{
"username": "[email protected]",
"repo_id": "104f6537-b3a5-4d42-b8b5-8e47e494e4cf",
"ctime": "2017-04-01T02:35:29+00:00",
"expire_date": "",
"token": "0c4eb0cb104a43caaeef",
"view_cnt": 0,
"link": "https://cloud.seafile.com/d/0c4eb0cb104a43caaeef/",
"obj_name": "folder",
"path": "/folder/",
"is_dir": true,
"is_expired": false,
"repo_name": "for-test-web-api"
}
]

or a empty list [] if this folder has no download share link.

Get file download share link.

curl -H 'Authorization: Token 0eb24ce5db35a31f70171eca2f760f03f59fa09a' -H 'Accept: application/json; charset=utf-8; indent=4' "https://cloud.seafile.com/api/v2.1/share-links/?repo_id=104f6537-b3a5-4d42-b8b5-8e47e494e4cf&path=/tmp.md"

Sample response

[
{
"username": "[email protected]",
"repo_id": "104f6537-b3a5-4d42-b8b5-8e47e494e4cf",
"ctime": "2017-04-01T02:35:35+00:00",
"expire_date": "",
"token": "8c05a00c44db4764b3a5",
"view_cnt": 0,
"link": "https://cloud.seafile.com/f/8c05a00c44db4764b3a5/",
"obj_name": "tmp.md",
"path": "/tmp.md",
"is_dir": false,
"is_expired": false,
"repo_name": "for-test-web-api"
}
]

or a empty list [] if this file has no download share link.

Errors

  • 403 Permission denied.

  • 404 folder/library not found.

  • 500 Internal Server Error

Create Share Link

POST https://cloud.seafile.com/api/v2.1/share-links/

Request parameters

  • repo-id

  • path (file/folder path)

  • password (not necessary)

  • expire_days (not necessary)

Sample request

Create download link for file

curl -d "path=/foo.md&repo_id=62ca6cf9-dab6-47e5-badc-bab13d9220ce" -H 'Authorization: Token ef12bf1e66a1aa797a1d6556fdc9ae84f1e9249f' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api/v2.1/share-links/

Create download link for directory with password and expire date

curl -d "path=/bar/&repo_id=62ca6cf9-dab6-47e5-badc-bab13d9220ce&password=password&expire_days=6" -H 'Authorization: Token ef12bf1e66a1aa797a1d6556fdc9ae84f1e9249f' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api/v2.1/share-links/

Sample response

{
"username": "[email protected]",
"view_cnt": 0,
"ctime": "2016-03-04T04:06:35.477",
"token": "409f5aa54a",
"repo_id": "62ca6cf9-dab6-47e5-badc-bab13d9220ce",
"link": "https://cloud.seafile.com/f/409f5aa54a/",
"expire_date": null,
"path": "/foo.md",
"is_expired": false
}
{
"username": "[email protected]",
"view_cnt": 0,
"ctime": "2016-03-04T04:12:48.959",
"token": "db1a50e686",
"repo_id": "62ca6cf9-dab6-47e5-badc-bab13d9220ce",
"link": "https://cloud.seafile.com/d/db1a50e686/",
"expire_date": null,
"path": "/bar/",
"is_expired": false
}

Errors

  • 400 path/repo_id invalid

  • 403 Permission denied.

  • 404 file/folder/library not found.

  • 500 Internal Server Error

Delete Share Link

DELETE https://cloud.seafile.com/api/v2.1/share-links/{token}/

Sample request

curl -X DELETE -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' "https://cloud.seafile.com/api/v2.1/share-links/0ae587a7d1/"

Sample response

{"success":true}

Send Share Link Email

POST https://cloud.seafile.com/api2/send-share-link/

Request parameters

  • token

  • email

  • extra_msg (not necessary)

Sample request

curl -d "[email protected],invalid-email&token=4cbd625c5e" -H 'Authorization: Token ef12bf1e66a1aa797a1d6556fdc9ae84f1e9249f' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/send-share-link/

Sample response

{
"failed": [
{
"email": "invalid-email",
"error_msg": "email invalid."
}
],
"success": [
]
}

Errors

  • 400 token/repo_id invalid

  • 403 Permission denied.

  • 403 Sending shared link failed. Email service is not properly configured, please contact administrator.

  • 404 token/library not found

List Direntry in Dir Download Link

GET https://cloud.seafile.com/api2/d/{token}/dir/

Request parameters

  • token (upload link token)

  • p (sub folder path)

  • password (if link is encrypted)

Sample request

curl -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' "https://cloud.seafile.com/api2/d/3af7c46595/dir/?p=/subfolder/"

Sample response

[{"mtime": 1436846750, "type": "dir", "name": "sadof", "id": "1806dbdb700b7bcd49e6275107c7ccf7b3ea1776"}, {"id": "bdb06f6de972c42893fda590ac954988b562429c", "mtime": 1436431020, "type": "file", "name": "test.mdert", "size": 20}]

List Upload Links

GET https://cloud.seafile.com/api/v2.1/upload-links/

Sample request

curl -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' "https://cloud.seafile.com/api/v2.1/upload-links/"

Sample response

[{"username":"[email protected]","repo_id":"62ca6cf9-dab6-47e5-badc-bab13d9220ce","ctime":"2016-03-03T15:26:15.223","token":"9a5d5c8391","link":"https://cloud.seafile.com/u/d/9a5d5c8391/","path":"/"},{"username":"[email protected]","repo_id":"78c620ee-2989-4427-8eff-7748f4fbebc0","ctime":"2016-03-04T05:37:17.968","token":"d17d87ea4d","link":"https://cloud.seafile.com/u/d/d17d87ea4d/","path":"/yutong/"}]

Create Upload Link

POST https://cloud.seafile.com/api/v2.1/upload-links/

Request parameters

  • repo-id

  • path (file/folder path)

  • password (not necessary)

Sample request

Create upload link for directory with password

curl -d "path=/bar/&repo_id=afc3b694-7d4c-4b8a-86a4-89c9f3261b12&password=password" -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api/v2.1/upload-links/

Sample response

{
"username": "[email protected]",
"repo_id": "62ca6cf9-dab6-47e5-badc-bab13d9220ce",
"ctime": "2016-03-04T05:51:34.022",
"token": "dce40e8594",
"link": "https://cloud.seafile.com/u/d/dce40e8594/",
"path": "/bar/"
}

Errors

  • 400 path/repo_id invalid

  • 403 Permission denied.

  • 500 Internal Server Error

Delete Upload Link

DELETE https://cloud.seafile.com/api/v2.1/upload-links/{token}/

Sample request

curl -X DELETE -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' "https://cloud.seafile.com/api/v2.1/upload-links/0ae587a7d1/"

Sample response

{"success":true}

Send Upload Link Email

POST https://cloud.seafile.com/api2/send-upload-link/

Request parameters

  • token

  • email

  • extra_msg (not necessary)

Sample request

curl -d "[email protected],invalid-email&token=4cbd625c5e" -H 'Authorization: Token ef12bf1e66a1aa797a1d6556fdc9ae84f1e9249f' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/send-upload-link/

Sample response

{
"failed": [
{
"email": "invalid-email",
"error_msg": "email invalid."
}
],
"success": [
]
}
  • 400 token/repo_id invalid

  • 403 Permission denied.

  • 403 Sending shared link failed. Email service is not properly configured, please contact administrator.

  • 404 token/library not found

Shared Libraries

List User Shared Libraries

GET https://cloud.seafile.com/api2/repos/7460f7ac-a0ff-4585-8906-bb5a57d2e118/dir/shared_items/?p=/&share_type=user

Request parameters

  • p, / means the root folder, which is equivalent to the library.

  • share_type, user

Sample request

curl -v -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/repos/7460f7ac-a0ff-4585-8906-bb5a57d2e118/dir/shared_items/?p=/&share_type=user

Sample response

[
{"user_info": {"nickname": "5", "name": "[email protected]"}, "share_type": "user", "permission": "r"},
{"user_info": {"nickname": "name of 4", "name": "[email protected]"}, "share_type": "user", "permission": "r"}
]

Errors

  • 400 share_type invalid.

  • 403 Permission denied.

  • 404 Library not found.

List Group Shared Libraries

GET https://cloud.seafile.com/api2/repos/7460f7ac-a0ff-4585-8906-bb5a57d2e118/dir/shared_items/?p=/&share_type=group

Request parameters

  • p, / means the root folder, which is equivalent to the library.

  • share_type, group

Sample request

curl -v -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/repos/7460f7ac-a0ff-4585-8906-bb5a57d2e118/dir/shared_items/?p=/&share_type=group

Sample response

[
{"group_info": {"id": 65, "name": "group"}, "share_type": "group", "permission": "r"},
{"group_info": {"id": 395, "name": "lsd"}, "share_type": "group", "permission": "rw"}
]

Errors

  • 400 share_type invalid.

  • 403 Permission denied.

  • 404 Library not found.

List Be Shared Libraries

GET https://cloud.seafile.com/api2/beshared-repos/

Sample request

curl -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' "https://cloud.seafile.com/api2/beshared-repos/"

Sample response

"[{"user": "[email protected]", "repo_id": "989e3952-9d6f-4427-ab16-4bf9b53212eb", "share_type": "personal", "permission": "rw", "encrypted": false, "repo_desc": "lib shared to imwhatiam", "enc_version": false, "last_modified": 1398218747, "is_virtual": false, "group_id": 0, "repo_name": "lib shared to imwhatiam"}]"

Delete Be Shared Library

DELETE https://cloud.seafile.com/api2/beshared-repos/{repo_id}/?share_type=personal&[email protected]

Sample request

curl -X DELETE -H "Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd" -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/beshared-repos/{repo_id}/?share_type=personal&[email protected]

Sample response

{"success": true}

Errors

  • 400 Invalid argument

  • 400 Library does not exist

Share a Library to User

PUT https://cloud.seafile.com/api2/repos/{repo_id}/dir/shared_items/?p=/

Request parameters

  • p, / means the root folder, which is equivalent to the library.

  • share_type, user

  • username, a email string or a list contains multi emails

  • permission, default r

Sample request

curl -X PUT -d "share_type=user&[email protected]&[email protected]&[email protected]&permission=r" -H 'Authorization: Token 0eb24ce5db35a31f70171eca2f760f03f59fa09a' -H 'Accept: application/json; charset=utf-8; indent=4' https://cloud.seafile.com/api2/repos/7460f7ac-a0ff-4585-8906-bb5a57d2e118/dir/shared_items/?p=/

Sample response

{
"failed": [
{"email": "[email protected]", "error_msg": "User [email protected] not found."}
],
"success": [
{"user_info": {"nickname": "name of 4", "name": "[email protected]"}, "share_type": "user", "permission": "r"},
{"user_info": {"nickname": "5", "name": "[email protected]"}, "share_type": "user", "permission": "r"}
]
}

Errors

  • 400 permission invalid.

  • 400 share_type invalid.

  • 403 Permission denied.

  • 404 Library not found.

Unshare a Library from User

DELETE https://cloud.seafile.com/api2/repos/{repo_id}/dir/shared_items/?p=/&share_type=user&[email protected]

Request parameters

  • p, / means the root folder, which is equivalent to the library.

  • share_type, user

  • username, a email string

Sample request

curl -X DELETE -H 'Authorization: Token 0eb24ce5db35a31f70171eca2f760f03f59fa09a' -H 'Accept: application/json; charset=utf-8; indent=4' "https://cloud.seafile.com/api2/repos/7460f7ac-a0ff-4585-8906-bb5a57d2e118/dir/shared_items/?p=/&share_type=user&[email protected]"

Sample response

{"success": true}

Errors

  • 400 share_type invalid.

  • 400 email invalid.

  • 403 Permission denied.

  • 404 Library not found.

Update Permission of User Shared Library

POST https://cloud.seafile.com/api2/repos/{repo_id}/dir/shared_items/?p=/&share_type=user&[email protected]

Request parameters

  • p, / means the root folder, which is equivalent to the library.

  • share_type, user

  • username, a email string

  • permisson, r or rw

Sample request

curl -d "permission=r" -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' -H 'Accept: application/json; indent=4' "https://cloud.seafile.com/api2/repos/2deffbac-d7be-4ace-b406-efb799083ee9/dir/shared_items/?p=/&share_type=user&[email protected]"

Sample response

{"success": true}

Errors

  • 400 share_type invalid.

  • 403 permission invalid.

  • 403 Permission denied.

  • 404 Library not found.

  • 404 Folder not found.

Share a Library to Group

PUT https://cloud.seafile.com/api2/repos/{repo_id}/dir/shared_items/?p=/

Request parameters

  • p, / means the root folder, which is equivalent to the library.

  • share_type, group

  • group_id , an integer or a list contains multi integers

  • permission, default r

Sample request

curl -X PUT -d "share_type=group&group_id=65&group_id=395&group_id=invalid_group_id&group_id=111&permission=rw" -H 'Authorization: Token 0eb24ce5db35a31f70171eca2f760f03f59fa09a' -H 'Accept: application/json; charset=utf-8; indent=4' https://cloud.seafile.com/api2/repos/7460f7ac-a0ff-4585-8906-bb5a57d2e118/dir/shared_items/?p=/

Sample response

{
"failed": [],
"success": [
{"group_info": {"id": 65, "name": "group"}, "share_type": "group", "permission": "rw"},
{"group_info": {"id": 395, "name": "lsd"}, "share_type": "group", "permission": "rw"}
]
}

Errors

  • 400 permission invalid.

  • 400 group_id invalid.

  • 400 share_type invalid.

  • 403 Permission denied.

  • 404 Library not found.

Unshare a Library from Group

DELETE https://cloud.seafile.com/api2/repos/{repo_id}/dir/shared_items/?p=/&share_type=group&group=65

Request parameters

  • p, / means the root folder, which is equivalent to the library.

  • share_type, group

  • group_id , an integer

Sample request

curl -X DELETE -H 'Authorization: Token 0eb24ce5db35a31f70171eca2f760f03f59fa09a' -H 'Accept: application/json; charset=utf-8; indent=4' "https://cloud.seafile.com/api2/repos/7460f7ac-a0ff-4585-8906-bb5a57d2e118/dir/shared_items/?p=/&share_type=group&group_id=65"

Sample response

{"success": true}

Errors

  • 400 share_type invalid.

  • 400 group_id invalid.

  • 403 Permission denied.

  • 404 Library not found.

Update Permission of Group Shared Library

POST https://cloud.seafile.com/api2/repos/{repo_id}/dir/shared_items/?p=/&share_type=group&group_id=65

Request parameters

  • p, / means the root folder, which is equivalent to the library.

  • share_type, group

  • group_id , an integer

  • permisson, r or rw

Sample request

curl -d "permission=r" -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' -H 'Accept: application/json; indent=4' "https://cloud.seafile.com/api2/repos/2deffbac-d7be-4ace-b406-efb799083ee9/dir/shared_items/?p=/&share_type=group&group_id=65"

Sample response

{"success": true}

Errors

  • 400 share_type invalid.

  • 403 permission invalid.

  • 403 Permission denied.

  • 404 Library not found.

Batch Share Libraries to User

POST https://cloud.seafile.com/api/v2.1/repos/batch/

Request parameters

  • operation, share

  • share_type, user

  • username, email of a user

  • permission, default is rw

  • repo_id

Sample request

curl -d "operation=share&share_type=user&[email protected]&repo_id=b6cfa05d-07af-422b-924e-45202dc1cbb5&repo_id=48aa475d-deb0-40f0-ab9b-22ec84989a58" -H 'Authorization: Token 40c89d06a2beeec672d091156de4cc163c6aa31a' -H 'Accept: application/json; charset=utf-8; indent=4' https://cloud.seafile.com/api/v2.1/repos/batch/

Sample response

{
"failed": [
{"repo_id": "3761ade3-100b-4c3b-9508-79b3a510e6f6", "error_msg": "This item has been shared to [email protected]"}
],
"success": [
{"username": "[email protected]", "repo_id": "f820bd12-0511-4542-b14b-3e48d8efc294", "permission": "rw"}
]
}

Errors

  • 400 permission invalid.

  • 400 share_type invalid.

  • 403 Permission denied.

  • 404 Library not found.

  • 404 User not found.

  • 500 Internal Server Error

Batch Share Libraries to Group

POST https://cloud.seafile.com/api/v2.1/repos/batch/

Request parameters

  • operation, share

  • share_type, group

  • group_id

  • permission, default is rw

  • repo_id

Sample request

curl -d "operation=share&share_type=group&group_id=540&repo_id=b6cfa05d-07af-422b-924e-45202dc1cbb5&repo_id=48aa475d-deb0-40f0-ab9b-22ec84989a58" -H 'Authorization: Token 40c89d06a2beeec672d091156de4cc163c6aa31a' -H 'Accept: application/json; charset=utf-8; indent=4' https://cloud.seafile.com/api/v2.1/repos/batch/

Sample response

{
"failed": [
{"repo_id": "f820bd12-0511-4542-b14b-3e48d8efc294", "error_msg": "This item has been shared to group-of-lian."}
],
"success": [
{"permission": "rw", "repo_id": "3761ade3-100b-4c3b-9508-79b3a510e6f6", "group_id": 65, "group_name": "group-of-lian"}
]
}

Errors

  • 400 permission invalid.

  • 400 share_type invalid.

  • 403 Permission denied.

  • 404 Library not found.

  • 404 Group not found.

  • 500 Internal Server Error

Shared Folders

Share A Folder

PUT https://cloud.seafile.com/api2/repos/{repo-id}/dir/shared_items/?p={path}

  • repo-id

  • path

  • permission, r or rw

  • share_type, user or group

  • username, necessary if share_type is user

  • group_id, necessary if share_type is group

Sample request for share folder to user

curl -X PUT -d "[email protected]&share_type=user&permission=r" -H 'Authorization: Token ef12bf1e66a1aa797a1d6556fdc9ae84f1e9249f' -H 'Accept: application/json; charset=utf-8; indent=4' https://cloud.seafile.com/api2/repos/78c620ee-2989-4427-8eff-7748f4fbebc0/dir/shared_items/?p=/q

Sample response for share folder to user

{"failed": [], "success": [{"user_info": {"nickname": "2", "name": "[email protected]"}, "share_type": "user", "permission": "r"}]}

Sample request for share folder to group

curl -X PUT -d "group_id=772&share_type=group&permission=rw" -H 'Authorization: Token ef12bf1e66a1aa797a1d6556fdc9ae84f1e9249f' -H 'Accept: application/json; charset=utf-8; indent=4' https://cloud.seafile.com/api2/repos/78c620ee-2989-4427-8eff-7748f4fbebc0/dir/shared_items/?p=/q

Sample response for share folder to group

{"failed": [], "success": [{"group_info": {"id": 772, "name": "group-2"}, "share_type": "group", "permission": "rw"}]}

Errors

  • 400 share_type/permission/group_id invalid.

  • 403 Permission denied.

  • 404 Library/Folder/Group not found.

  • 500 Failed to get sub repo.

List Shared Folders

GET https://cloud.seafile.com/api/v2.1/shared-folders/

Sample request

curl -v -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api/v2.1/shared-folders/

Sample response

[
{
"share_permission": "rw",
"repo_id": "2deffbac-d7be-4ace-b406-efb799083ee9",
"share_type": "personal",
"folder_name": "asd",
"path": "/asd",
"user_name": "1",
"contact_email": "[email protected]",
"user_email": "[email protected]"
},
{
"share_permission": "r",
"repo_id": "2deffbac-d7be-4ace-b406-efb799083ee9",
"share_type": "group",
"group_name": "test_group",
"folder_name": "asd",
"path": "/asd",
"group_id": 1448
}
]

Errors

  • 500 Internal Server Error

Update Shared Folder Permission

POST https://cloud.seafile.com/api2/repos/2deffbac-d7be-4ace-b406-efb799083ee9/dir/shared_items/?p=/asd&share_type=user&[email protected]

Sample request

curl -d "permission=r" -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/repos/2deffbac-d7be-4ace-b406-efb799083ee9/dir/shared_items/?p=/asd&share_type=user&[email protected]

Sample response

{"success":true}

Errors

  • 400 permission invalid.

  • 400 Email invalid.

  • 403 Permission denied.

  • 404 Library not found.

  • 404 Folder not found.

  • 500 Internal Server Error

Unshare A Folder

POST https://cloud.seafile.com/api2/repos/2deffbac-d7be-4ace-b406-efb799083ee9/dir/shared_items/?p=/asd&share_type=group&group_id=1448

Sample request

curl -X DELETE -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/repos/2deffbac-d7be-4ace-b406-efb799083ee9/dir/shared_items/?p=/asd&share_type=group&group_id=1448

Sample response

{"success":true}

Errors

  • 400 Email invalid.

  • 403 Permission denied.

  • 404 Library not found.

  • 404 Folder not found.

  • 500 Internal Server Error

Folder Permission

User Folder Permission

Get User Folder Permission

GET http://192.168.1.124:8000/api2/repos/{repo_id}/user-folder-perm/?folder_path=/123

Request parameters

  • repo_id

  • folder_path

Sample request

curl -H 'Authorization: Token cbd7705c06846425ed5c46ae0313d5b098d24154' -H 'Accept: application/json; charset=utf-8; indent=4' "http://192.168.1.124:8000/api2/repos/bdf816e6-aba8-468c-962f-77c2fcfd1d1c/user-folder-perm/?folder_path=/123"

Sample response

[
{
"repo_id": "bdf816e6-aba8-468c-962f-77c2fcfd1d1c",
"folder_path": "/123",
"permission": "r",
"folder_name": "123",
"user_name": "1",
"user_email": "[email protected]"
},
{
"repo_id": "bdf816e6-aba8-468c-962f-77c2fcfd1d1c",
"folder_path": "/123",
"permission": "rw",
"folder_name": "123",
"user_name": "2",
"user_email": "[email protected]"
}
]

Errors

  • 403 Permission denied.

  • 404 Library not found.

Set User Folder Permission

POST http://192.168.1.124:8000/api2/repos/{repo_id}/user-folder-perm/

Request parameters

  • repo_id

  • folder_path

  • user_email

  • permission, r or rw

Sample request

curl -d "folder_path=/123&permission=rw&[email protected]&[email protected]" -H 'Authorization: Token cbd7705c06846425ed5c46ae0313d5b098d24154' -H 'Accept: application/json; charset=utf-8; indent=4' "http://192.168.1.124:8000/api2/repos/bdf816e6-aba8-468c-962f-77c2fcfd1d1c/user-folder-perm/"

Sample response

{
"failed": [
{
"error_msg": "Permission already exists.",
"user_email": "[email protected]"
}
],
"success": [
{
"repo_id": "bdf816e6-aba8-468c-962f-77c2fcfd1d1c",
"folder_path": "/123",
"permission": "rw",
"folder_name": "123",
"user_name": "3",
"user_email": "[email protected]"
}
]
}

Errors

  • 400 folder_path invalid.

  • 400 permission invalid.

  • 403 Permission denied.

  • 404 Library not found.

  • 404 Folder not found.

Modify User Folder Permission

PUT http://192.168.1.124:8000/api2/repos/{repo_id}/user-folder-perm/

Request parameters

  • repo_id

  • folder_path

  • user_email

  • permission, r or rw

Sample request

curl -X PUT -d "folder_path=/123&permission=r&[email protected]" -H 'Authorization: Token cbd7705c06846425ed5c46ae0313d5b098d24154' -H 'Accept: application/json; charset=utf-8; indent=4' "http://192.168.1.124:8000/api2/repos/bdf816e6-aba8-468c-962f-77c2fcfd1d1c/user-folder-perm/"

Sample response

{
"repo_id": "bdf816e6-aba8-468c-962f-77c2fcfd1d1c",
"folder_path": "/123",
"permission": "r",
"folder_name": "123",
"user_name": "3",
"user_email": "[email protected]"
}

Errors

  • 400 folder_path invalid.

  • 400 permission invalid.

  • 400 user_email invalid.

  • 403 Permission denied.

  • 404 Library not found.

  • 404 Folder not found.

  • 404 User not found.

  • 404 Folder permission not found.

  • 500 Internal Server Error

Delete User Folder Permission

DELETE http://192.168.1.124:8000/api2/repos/{repo_id}/user-folder-perm/

Request parameters

  • repo_id

  • folder_path

  • user_email

Sample request

curl -X DELETE -d "folder_path=/123&[email protected]" -H 'Authorization: Token cbd7705c06846425ed5c46ae0313d5b098d24154' -H 'Accept: application/json; charset=utf-8; indent=4' "http://192.168.1.124:8000/api2/repos/bdf816e6-aba8-468c-962f-77c2fcfd1d1c/user-folder-perm/"

Sample response

{
"success": true
}

Errors

  • 400 user_email invalid.

  • 400 folder_path invalid.

  • 403 Permission denied.

  • 404 Library not found.

  • 404 User not found.

  • 500 Internal Server Error

Group Folder Permission

Get Group Folder Permission

GET http://192.168.1.124:8000/api2/repos/{repo_id}/group-folder-perm/?folder_path=/123

Request parameters

  • repo_id

  • folder_path

Sample request

curl -H 'Authorization: Token cbd7705c06846425ed5c46ae0313d5b098d24154' -H 'Accept: application/json; charset=utf-8; indent=4' "http://192.168.1.124:8000/api2/repos/bdf816e6-aba8-468c-962f-77c2fcfd1d1c/group-folder-perm/?folder_path=/123"

Sample response

[
{
"repo_id": "bdf816e6-aba8-468c-962f-77c2fcfd1d1c",
"folder_path": "/123",
"permission": "rw",
"group_name": "group-2-of-lian",
"folder_name": "123",
"group_id": 586
},
{
"repo_id": "bdf816e6-aba8-468c-962f-77c2fcfd1d1c",
"folder_path": "/123",
"permission": "r",
"group_name": "group-of-lian",
"folder_name": "123",
"group_id": 65
}
]

Errors

  • 403 Permission denied.

  • 404 Library not found.

Set Group Folder Permission

POST http://192.168.1.124:8000/api2/repos/{repo_id}/group-folder-perm/

Request parameters

  • repo_id

  • folder_path

  • group_id

  • permission, r or rw

Sample request

curl -d "folder_path=/123&permission=rw&group_id=586&group_id=65" -H 'Authorization: Token cbd7705c06846425ed5c46ae0313d5b098d24154' -H 'Accept: application/json; charset=utf-8; indent=4' "http://192.168.1.124:8000/api2/repos/bdf816e6-aba8-468c-962f-77c2fcfd1d1c/group-folder-perm/"

Sample response

{
"failed": [
{
"group_id": 65,
"error_msg": "Permission already exists."
}
],
"success": [
{
"repo_id": "bdf816e6-aba8-468c-962f-77c2fcfd1d1c",
"folder_path": "/123",
"permission": "rw",
"group_name": "group-2-of-lian",
"folder_name": "123",
"group_id": 586
}
]
}

Errors

  • 400 folder_path invalid.

  • 400 permission invalid.

  • 403 Permission denied.

  • 404 Library not found.

  • 404 Folder not found.

Modify Group Folder Permission

PUT http://192.168.1.124:8000/api2/repos/{repo_id}/group-folder-perm/

Request parameters

  • repo_id

  • folder_path

  • group_id

  • permission, r or rw

Sample request

curl -X PUT -d "folder_path=/123&permission=rw&group_id=65" -H 'Authorization: Token cbd7705c06846425ed5c46ae0313d5b098d24154' -H 'Accept: application/json; charset=utf-8; indent=4' "http://192.168.1.124:8000/api2/repos/bdf816e6-aba8-468c-962f-77c2fcfd1d1c/group-folder-perm/"

Sample response

{
"repo_id": "bdf816e6-aba8-468c-962f-77c2fcfd1d1c",
"folder_path": "/123",
"permission": "rw",
"group_name": "group-of-lian",
"folder_name": "123",
"group_id": 65
}

Errors

  • 400 folder_path invalid.

  • 400 permission invalid.

  • 400 group_id invalid.

  • 403 Permission denied.

  • 404 Library not found.

  • 404 Folder not found.

  • 404 Group not found.

  • 404 Folder permission not found.

  • 500 Internal Server Error

Delete Group Folder Permission

DELETE http://192.168.1.124:8000/api2/repos/{repo_id}/group-folder-perm/

Request parameters

  • repo_id

  • folder_path

  • group_id

Sample request

curl -X DELETE -d "folder_path=/123&group_id=65" -H 'Authorization: Token cbd7705c06846425ed5c46ae0313d5b098d24154' -H 'Accept: application/json; charset=utf-8; indent=4' "http://192.168.1.124:8000/api2/repos/bdf816e6-aba8-468c-962f-77c2fcfd1d1c/group-folder-perm/"

Sample response

{
"success": true
}

Errors

  • 400 group_id invalid.

  • 400 folder_path invalid.

  • 403 Permission denied.

  • 404 Library not found.

  • 404 Group not found.

  • 500 Internal Server Error

Library

Get Default Library

GET https://cloud.seafile.com/api2/default-repo/

Sample request

curl -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' "https://cloud.seafile.com/api2/default-repo/"

Sample response

{
"repo_id": "691b3e24-d05e-43cd-a9f2-6f32bd6b800e",
"exists": true
}

Create Default Library

POST https://cloud.seafile.com/api2/default-repo/

Sample request

curl -X POST -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' "https://cloud.seafile.com/api2/default-repo/"

Sample response

{
"repo_id": "691b3e24-d05e-43cd-a9f2-6f32bd6b800e",
"exists": true
}

List Libraries

GET https://cloud.seafile.com/api2/repos/?type={type}

Request parameters

  • type

    • mine, get my owned libraries.

    • shared, get libraries shared to me.

    • group, get group libraries.

    • org, get public libraires.

NOTE: If no type parameter contained in the url, this api will return all libraries user can access.

Sample request for get all libraries I can accessed

curl -H 'Authorization: Token 24fd3c026886e3121b2ca630805ed425c272cb96' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/repos/

Sample response for get all libraries I can accessed

[
{
"permission": "rw",
"encrypted": false,
"mtime_relative": "<time datetime=\"2017-08-12T10:48:42\" is=\"relative-time\" title=\"Sat, 12 Aug 2017 10:48:42 +0800\" >1 minute ago</time>",
"mtime": 1502506122,
"owner": "[email protected]",
"root": "",
"id": "b8c8eeaf-a62f-4ece-a2cb-e1c67f49f881",
"size": 0,
"name": "group-lib",
"type": "repo",
"virtual": false,
"version": 1,
"head_commit_id": "b0a8c797972b83af1054428a397f843612257425",
"size_formatted": "0 bytes"
},
{
"permission": "rw",
"encrypted": false,
"mtime_relative": "<time datetime=\"2017-08-03T17:42:49\" is=\"relative-time\" title=\"Thu, 3 Aug 2017 17:42:49 +0800\" >8 days ago</time>",
"mtime": 1501753369,
"owner": "[email protected]",
"root": "",
"id": "cd0df3ce-7e1b-4fc3-9b76-714c48db47d7",
"size": 1449,
"name": "My Library",
"type": "repo",
"virtual": false,
"version": 1,
"head_commit_id": "9d47232bb87d39dbbba54fb8f09f9795b2d396e4",
"size_formatted": "1.4 KB"
},
{
"owner_nickname": "lian",
"permission": "rw",
"encrypted": false,
"mtime_relative": "<time datetime=\"2017-08-12T10:44:07\" is=\"relative-time\" title=\"Sat, 12 Aug 2017 10:44:07 +0800\" >6 minutes ago</time>",
"mtime": 1502505847,
"owner": "[email protected]",
"root": "",
"id": "c474a093-19dc-4ddf-b0b0-72b33214ba33",
"size": 708833229,
"name": "seacloud.cc.124",
"share_type": "personal",
"type": "srepo",
"version": 1,
"head_commit_id": "0b11fc08518d0c9acfd15e95a580664896484336",
"size_formatted": "676.0 MB"
},
{
"permission": "rw",
"encrypted": false,
"mtime": 1502506122,
"owner": "asdf",
"id": "b8c8eeaf-a62f-4ece-a2cb-e1c67f49f881",
"size": 0,
"name": "group-lib",
"root": "",
"version": 1,
"head_commit_id": "b0a8c797972b83af1054428a397f843612257425",
"type": "grepo",
"groupid": 1675
},
{
"share_from": "[email protected]",
"permission": "rw",
"encrypted": false,
"mtime_relative": "<time datetime=\"2017-08-12T10:33:47\" is=\"relative-time\" title=\"Sat, 12 Aug 2017 10:33:47 +0800\" >16 minutes ago</time>",
"mtime": 1502505227,
"owner": "Organization",
"root": "",
"id": "050ef344-45fb-49b6-80e6-e1bf094ab7bd",
"size": 0,
"name": "public-repo",
"share_type": "public",
"type": "grepo",
"version": 1,
"head_commit_id": "b71a95373896eb52e2971d72a869b7c413791b0b",
"size_formatted": "0 bytes"
}
]

Sample request for get my owned libraries

curl -H "Authorization: Token 8cc0e7085a24b6abfee721e758b6aab4a90e7321" -H 'Accept: application/json; indent=4' "http://192.168.1.124:8000/api2/repos/?type=mine"

Sample response for get my owned libraries

[
{
"permission": "rw",
"encrypted": false,
"mtime_relative": "<time datetime=\"2017-08-12T10:48:42\" is=\"relative-time\" title=\"Sat, 12 Aug 2017 10:48:42 +0800\" >19 minutes ago</time>",
"mtime": 1502506122,
"owner": "[email protected]",
"root": "",
"id": "b8c8eeaf-a62f-4ece-a2cb-e1c67f49f881",
"size": 0,
"name": "group-lib",
"type": "repo",
"virtual": false,
"version": 1,
"head_commit_id": "b0a8c797972b83af1054428a397f843612257425",
"size_formatted": "0 bytes"
},
{
"permission": "rw",
"encrypted": false,
"mtime_relative": "<time datetime=\"2017-08-03T17:42:49\" is=\"relative-time\" title=\"Thu, 3 Aug 2017 17:42:49 +0800\" >8 days ago</time>",
"mtime": 1501753369,
"owner": "[email protected]",
"root": "",
"id": "cd0df3ce-7e1b-4fc3-9b76-714c48db47d7",
"size": 1449,
"name": "My Library",
"type": "repo",
"virtual": false,
"version": 1,
"head_commit_id": "9d47232bb87d39dbbba54fb8f09f9795b2d396e4",
"size_formatted": "1.4 KB"
}
]

Get Library Info

GET https://cloud.seafile.com/api2/repos/{repo-id}/

Request parameters

  • repo-id

Sample request

curl -G -H 'Authorization: Token 24fd3c026886e3121b2ca630805ed425c272cb96' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/repos/632ab8a8-ecf9-4435-93bf-f495d5bfe975/

Sample response

{
"encrypted": false,
"password_need": null,
"mtime": null,
"owner": "self",
"id": "632ab8a8-ecf9-4435-93bf-f495d5bfe975",
"size": 1356155,
"name": "org",
"root": "b5227040de360dd22c5717f9563628fe5510cbce",
"desc": "org file",
"type": "repo"
}

Get Library Owner

GET https://cloud.seafile.com/api2/repos/{repo-id}/owner/

Request parameters

  • repo-id

Sample request

curl -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d9b477fd' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/repos/dae8cecc-2359-4d33-aa42-01b7846c4b32/owner/

Sample response

{
}

Errors

  • 403 Permission error(only administrator/repo-owner can perform this action).

Get Library History

GET https://cloud.seafile.com/api/v2.1/repos/{repo_id}/history/

Request parameters

  • repo_id

  • page, default 1

  • per_page, default 100

Sample request

curl -H 'Authorization: Token 0eb24ce5db35a31f70171eca2f760f03f59fa09a' -H 'Accept: application/json; charset=utf-8; indent=4' "https://cloud.seafile.com/api/v2.1/repos/7460f7ac-a0ff-4585-8906-bb5a57d2e118/history/"

Sample response

{
"data": [
{
"commit_id": "2b1313e4bbce2b938403c829b114b12b549128a3",
"time": "2017-04-10T03:24:09+00:00",
"description": "Recovered deleted directory \"456\"",
"creator": "[email protected]"
},
{
"commit_id": "0be8bba456ece31598557d9f3d5471b5b4d9d7c0",
"time": "2017-04-10T03:23:49+00:00",
"description": "Removed directory \"456\"",
"creator": "[email protected]"
},
{
"commit_id": "e6f21a80d60b7f1797434fdab622e562af937f81",
"time": "2017-04-10T03:23:45+00:00",
"description": "Deleted \"empty.docx\"",
"creator": "[email protected]"
},
{
"commit_id": "0bddb7401a75a9799209a24fb118e8d49151b6d6",
"time": "2017-04-10T03:23:41+00:00",
"description": "Deleted \"QQ_account_manager.png\"",
"creator": "[email protected]"
}
],
"more": false
}

Errors

  • 403 Permission denied.

  • 404 Library not found.

  • 500 Internal Server Error

Get Library Trash

GET https://cloud.seafile.com/api/v2.1/repos/{repo_id}/trash/

Request parameters

  • repo_id

  • path, default '/'.

  • per_page, default 100.

  • scan_stat, An opaque status returned by the last call. In the first call, None must be passed. The last entry of the result list contains a 'scan_stat' attribute. In the next call, pass in the returned 'scan_stat'.

Sample request

curl -H 'Authorization: Token 0eb24ce5db35a31f70171eca2f760f03f59fa09a' -H 'Accept: application/json; charset=utf-8; indent=4' "https://cloud.seafile.com/api/v2.1/repos/7460f7ac-a0ff-4585-8906-bb5a57d2e118/trash/"

Sample response

{
"scan_stat": "2b1313e4bbce2b938403c829b114b12b549128a3",
"data": [
{
"commit_id": "2364981a2bef50c16281a664df55af209019a88c",
"scan_stat": null,
"obj_id": "f86ef37332e89d6a132e27ce857c76e15971b227",
"deleted_time": "2017-04-10T03:23:41+00:00",
"obj_name": "QQ_account_manager.png",
"is_dir": false,
"parent_dir": "/",
"size": 77970
},
{
"commit_id": "0bddb7401a75a9799209a24fb118e8d49151b6d6",
"scan_stat": null,
"obj_id": "10ae7309338efe92d9ceddb9d6835463d277da34",
"deleted_time": "2017-04-10T03:23:45+00:00",
"obj_name": "empty.docx",
"is_dir": false,
"parent_dir": "/456/",
"size": 10682
}
...
],
"more": true
}

Get more trash items.

Sample request

curl -H 'Authorization: Token 0eb24ce5db35a31f70171eca2f760f03f59fa09a' -H 'Accept: application/json; charset=utf-8; indent=4' "https://cloud.seafile.com/api/v2.1/repos/7460f7ac-a0ff-4585-8906-bb5a57d2e118/trash/?scan_stat=2b1313e4bbce2b938403c829b114b12b549128a3"

Sample response

{
"scan_stat": null,
"data": [
{
"commit_id": "726d2ce009df9176592ab88eca297b5e50c15639",
"scan_stat": null,
"obj_id": "cfc5e4299a862b366c98eeb7f5a8a1f689d2916a",
"deleted_time": "2017-04-10T09:11:02+00:00",
"obj_name": "empty.xlsx",
"is_dir": false,
"parent_dir": "/456/",
"size": 8176
},
{
"commit_id": "2b1313e4bbce2b938403c829b114b12b549128a3",
"scan_stat": null,
"obj_id": "414a75f5c67ca56c480ca2ae9137b7812940c3ce",
"deleted_time": "2017-04-10T09:11:01+00:00",
"obj_name": "empty.pptx",
"is_dir": false,
"parent_dir": "/456/",
"size": 40506
}
],
"more": false
}

Errors

  • 403 Permission denied.

  • 404 Library not found.

  • 500 Internal Server Error

Get Library History Limit Days

GET https://cloud.seafile.com/api2/repos/{repo-id}/history-limit/

Request parameters

  • repo-id

Sample request

curl -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d9b477fd' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/repos/dae8cecc-2359-4d33-aa42-01b7846c4b32/history-limit/

Sample response

{
"keep_days": -1,
}

Errors

  • 403 Permission denied.

  • 404 Library not found.

  • 500 Internal Server Error

Set Library History Limit Days

PUT https://cloud.seafile.com/api2/repos/{repo-id}/history-limit/

Request parameters

  • repo-id

  • keep_days. -1 for keep full history; 0 for do not keep history; positive number for keep a period of limit days.

Sample request

curl -v -X PUT -d "keep_days=4" -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' -H 'Accept: application/json; charset=utf-8; indent=4' https://cloud.seafile.com/api2/repos/dae8cecc-2359-4d33-aa42-01b7846c4b32/history-limit/

Sample response

{
"keep_days": 4,
}

Errors

  • 400 keep_days invalid.

  • 403 Permission denied.

  • 404 Library not found.

  • 500 Internal Server Error

  • 520 Failed to set library history limit.

Create Library

POST https://cloud.seafile.com/api2/repos/

Request parameters

  • name

  • desc (defaults to "new repo")

  • passwd (needed by encrypt library)

Sample request

curl -v -d "name=foo&desc=new library" -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/repos/

Sample response

{
"encrypted": "",
"enc_version": 0,
"repo_id": "f15811fd-5c19-412c-b143-2ac83f352290",
"magic": "",
"relay_id": "c5e41170db250ea497075e2911104faf0105b7fb",
"repo_version": 1,
"relay_addr": "cloud.seafile.com",
"token": "c1f3defe9ba408cd7964427ec276843e9d10c23b",
"relay_port": "10001",
"random_key": "",
"email": "[email protected]",
"repo_name": "foo"
}

Success

Response code 200 and newly created library information are returned.

Errors

  • 400 Library name missing.

  • 520 Operation failed.

Check/Create Sub Library

check if a dir has a corresponding sub_repo, if it does not have, create one

GET https://cloud.seafile.com/api2/repos/{repo-id}/dir/sub_repo/?p=/\&name=sub_lib

Request parameters

  • repo-id

  • p

  • name

Sample request

curl -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d9b477fd' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/repos/dae8cecc-2359-4d33-aa42-01b7846c4b32/dir/sub_repo/?p=/\&name=sub_lib

Sample response

{"sub_repo_id": "c0a3283c-013c-4a7c-8f68-006f06fa6dec"}

Errors

  • 400 Argument missing

  • 500 INTERNAL SERVER ERROR

Delete Library

DELETE https://cloud.seafile.com/api2/repos/{repo-id}/

Sample request

curl -v -X DELETE -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/repos/8f5f2222-72a8-454f-ac40-8397c5a556a8/

Sample response

"success"

Errors

  • 400 Library does not exist.

  • 403 Only library owner can perform this operation.

Rename Library

POST https://cloud.seafile.com/api2/repos/{repo-id}/?op=rename

Sample request

curl -d "repo_name=new-repo-name" -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d99b477fd' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/repos/8f5f2222-72a8-454f-ac40-8397c5a556a8/op=rename

Sample response

"success"

Errors

  • 404 Library not found.

  • 403 You do not have permission to rename this library.

  • 500 Unable to rename library

Transfer Library

PUT https://cloud.seafile.com/api2/repos/{repo-id}/owner/

Request parameters

  • repo-id

  • owner

Sample request

curl -v -X PUT -d "[email protected]" -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d9b477fd' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/repos/dae8cecc-2359-4d33-aa42-01b7846c4b32/owner/

Sample response

{
"success": True
}

Errors

  • 440 Email invalid.

  • 403 Permission error(only administrator/repo-owner can perform this action).

  • 404 Library not found.

  • 404 User not found.

Decrypt Library

POST https://cloud.seafile.com/api2/repos/{repo-id}/

Request parameters

  • password

Sample request

curl -v -d "password=123" -H 'Authorization: Token e6a33d61954f219a96b60f635cf02717964e4385' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/repos/0c2465a5-4753-4660-8a22-65abec9ec8d0/

Sample response

"success"

Errors

  • 400 Incorrect password

  • 409 Repo is not encrypt

  • 500 Internal server error

Create Public Library

POST https://cloud.seafile.com/api2/repos/public/

Request parameters

  • name

  • permission, r or rw, default r.

  • passwd (optional).

Sample request, create an encrypted public repo with rw permission

curl -X POST -d "name=test-public-repo&permission=rw&passwd=password" -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d9b477fd' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/repos/public/

Sample response

{
"owner_nickname": "lian",
"permission": "rw",
"encrypted": true,
"mtime_relative": "<time datetime=\"2016-05-31T12:01:49\" is=\"relative-time\" title=\"Tue, 31 May 2016 12:01:49 +0800\" >1 second ago</time>",
"mtime": 1464667309,
"owner": "[email protected]",
"id": "6553fd8b-bf3e-41ad-a481-90c8523d3b4a",
"size": 0,
"name": "test-public-repo",
"desc": "",
"size_formatted": "0 bytes"
}

Errors

  • 400 Library name is required.

  • 400 Invalid permission

  • 403 You do not have permission to create library.

  • 403 NOT allow to create encrypted library.

Set Exist Lib as Public Library

PUT https://cloud.seafile.com/api2/shared-repos/{repo-id}/?share_type=public

Request parameters

  • repo_id

  • share_type, must be public

  • permission, r or rw.

Sample request, create an encrypted public repo with rw permission

curl -X PUT -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d9b477fd' -H 'Accept: application/json; indent=4' 'https://cloud.seafile.com/api2/shared-repos/2deffbac-d7be-4ace-b406-efb799083ee9/?share_type=public&permission=rw'

Sample response

success

Errors

  • 400 Permission need to be rw or r.

  • 403 You do not have permission to share library.

  • 500 Failed to share library to public.

Remove Public Library

DELETE https://cloud.seafile.com/api2/shared-repos/{repo-id}/?share_type=public

Request parameters

  • repo-id

  • share_type

Sample request

curl -X DELETE -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d9b477fd' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/shared-repos/dae8cecc-2359-4d33-aa42-01b7846c4b32/?share_type=public

Success

"success"

Errors

  • 400 Share type is required.

  • 400 Share type can only be personal or group or public.

  • 403 You do not have permission to unshare library.

Fetch library download info

GET https://cloud.seafile.com/api2/repos/{repo-id}/download-info/

Request parameters

  • repo-id

Sample request

curl -H 'Authorization: Token f2210dacd9c6ccb8133606d94ff8e61d9b477fd' -H 'Accept: application/json; indent=4' https://cloud.seafile.com/api2/repos/dae8cecc-2359-4d33-aa42-01b7846c4b32/download-info/

Sample response

{
"applet_root": "https://localhost:13420",
"relay_addr": "localhost",
"token": "46acc4d9ca3d6a5c7102ef379f82ecc1edc629e1",
"repo_id": "dae8cecc-2359-4d33-aa42-01b7846c4b32",
"relay_port": "10002",
"encrypted": "",
"repo_name": "test",
"relay_id": "8e4b13b49ca79f35732d9f44a0804940d985627c",
}

Search Files in Libraries

GET https://cloud.seafile.com/api2/search/

Request parameters

  • q, keyword for searching.

  • page, optional, a number greater than or equal to 1.

  • per_page, optional.

  • search_repo, all, mine, shared, group, public or a repo_id, (all for searching in all libraries, etc.), optional. For searching in shared libraries, you can also pass shared_from or not_shared_from parameter beside shared to filter shared libraries.

  • search_path, path of specifiy library.(This option works only when search_repo is a single repo_id.)

  • search_ftypes, all or custom, (all for searching all file types, custom for only searching the specific file types you defined in ftype and input_fexts).

  • ftype, must be in (Text, Document, Image, Video, Audio, PDF, Markdown).

TEXT: ('ac', 'am', 'bat', 'c', 'cc', 'cmake', 'cpp', 'cs', 'css', 'diff', 'el', 'h', 'html', 'htm', 'java', 'js', 'json', 'less', 'make', 'org', 'php', 'pl', 'properties', 'py', 'rb', 'scala', 'script', 'sh', 'sql', 'txt', 'text', 'tex', 'vi', 'vim', 'xhtml', 'xml', 'log', 'csv', 'groovy', 'rst', 'patch', 'go'),

DOCUMENT: ('doc', 'docx', 'ppt', 'pptx', 'odt', 'fodt', 'odp', 'fodp'),

IMAGE: ('gif', 'jpeg', 'jpg', 'png', 'ico', 'bmp', 'tif', 'tiff', 'eps'),

VIDEO: ('mp4', 'ogv', 'webm', 'mov'),

AUDIO: ('mp3', 'oga', 'ogg'),

PDF: ('pdf',),

MARKDOWN: ('markdown', 'md'),

  • input_fexts, file extensions manually specific.

  • with_permission, true or false. Whether return permission info of the file or not, default is false.

Sample request

curl -H 'Authorization: Token 076de58233c09f19e7a5179abff14ad55987350e' -H 'Accept: application/json; charset=utf-8; indent=4' "https://cloud.seafile.com/api2/search/?q=seafile&search_repo=all&search_ftypes=custom&ftype=Document&input_fexts=md,png&per_page=3&page=3&with_permission=true"

Sample response

{
"has_more": true,
"total": 336,
"results": [
{
"repo_id": "040a8aad-5646-4c68-ba8a-73f90c60089f",
"name": "seafile \u8fd0\u7ef4.docx",
"permission": "r",
"oid": "ecba7db3d6b818873bf94cb1f2161f6a0fc22494",
"last_modified": 1482910730,
"content_highlight": "... .<b>seafile</b>.com...",
"fullpath": "/\u4e1c\u98ce\u65e5\u4ea7/Archived/seafile \u8fd0\u7ef4.docx",
"repo_name": "\u4ee3\u7ef4\u5ba2\u6237",
"is_dir": false,
"repo_type": 'mine',