Libraries and Files
Updated: 2022-06-29
Use the access token
obtained from Login and Authorization to operate on user libraries and files.
- Library List
- Create Library
- File List
- File Download URL
- File Preview URL
- File (Folder) Information
- Folder File Count
- Create Folder
- Upload File
- Web Upload
- Copy File
- Move File
- Rename File
- Delete File
- Add File to Favorites
- Remove from Favorites
- Favorite Files List
- File Search
API Domain
Host: app.fileshow.com
Library List
Retrieve libraries created by and joined by the user.
GET /m-api/1/account/mount
Request Parameters
Parameter | Required | Description |
---|---|---|
token | Yes | access token |
dateline | Yes | current Unix timestamp in seconds |
sign | Yes | signature |
Response Format
json
Response
{
"list": [
{
"ent_id": 0,
"org_id": 1,
"org_name": "Personal Files",
"mount_id": 1,
"org_type": 0,
"member_count": 0,
"owner_member_id": 2,
"org_logo_url": "http://dn-avatar.fileshow.com/36/3673e5b2778a8fa94db911c5c2473f8443c138fc.jpg",
"size_org_total": 21474836480,
"size_org_use": 806623,
"storage_point": "",
"storage_ethernet": 1
},
...
]
}
Field | Type | Description |
---|---|---|
ent_id | int | Enterprise ID |
org_id | int | Library ID |
org_name | string | Library name |
mount_id | int | Library space ID |
org_type | int | Library type |
member_count | int | Total members |
owner_member_id | int | Owner's member ID |
org_logo_url | string | Library icon URL |
size_org_total | bigint | Total library space size in bytes |
size_org_use | bigint | Used library space size in bytes |
storage_point | string | Storage point |
storage_ethernet | int | Allow external network access (1 for yes, 0 for no) |
Note:
- Libraries where
ent_id
=0 are personal libraries not in any enterprise. - Libraries where
org_type
=20 are personal files in an enterprise.
Create Library
Note: User needs permission to create libraries
POST /m-api/1/library/create
Request Parameters
Parameter | Required | Description |
---|---|---|
token | Yes | access token |
name | Yes | library name |
ent_id | Yes | enterprise ID |
capacity | No | storage space limit in bytes, -1 means no limit |
storage_point | No | storage point, default if not provided |
dateline | Yes | current Unix timestamp in seconds |
sign | Yes | signature |
Response Format
json
Response
Field | Type | Description |
---|---|---|
org_id | int | Library ID |
mount_id | int | Library space ID |
storage_point | string | Storage point |
File List
GET /m-api/1/file/ls
Request Parameters
Name | Required | Description |
---|---|---|
token | Yes | access token |
mount_id | Yes | library space ID |
fullpath | - | full path of the folder, for example, Public Data\Market Documents |
sort | - | list files by type, 1 for video, 2 for audio, 3 for image, 5 for document |
dir | No | 1 to only return folders, default 0 returns both |
start | No | starting position, default 0 |
size | No | number of items to retrieve, default 100 |
order | No | default is descending by last modified time, filename for file name, filesize for file size |
sign | Yes | signature |
Response Format
json
Response
{
"count": 2,
"list": [
{
"hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"mount_id": 1,
"dir": 1,
"fullpath": "Public Data",
"filename": "Public Data",
"filehash": "",
"filesize": 0,
"create_member_id": "1",
"create_member_name": "Me",
"create_dateline": 1452569732,
"last_member_id": "1",
"last_member_name": "Me",
"last_dateline": 1452569732,
"thumbnail": "",
"lock": 0
},
{
"hash": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"mount_id": 1,
"dir": 0,
"fullpath": "Word Document.doc",
"filename": "Word Document.doc",
"filehash": "ffffffffffffffffffffffffffffffffffffffff",
"filesize": 204800,
"create_member_id": "1",
"create_member_name": "Me",
"create_dateline": 1442563789,
"last_member_id": "1",
"last_member_name": "Me",
"last_dateline": 1449505954,
"thumbnail": "",
"lock": 0
},
......
]
}
Field | Type | Description |
---|---|---|
hash | string | unique file ID |
mount_id | int | library space ID |
dir | int | is it a folder? |
fullpath | string | full file path |
filename | string | file name |
filehash | string | file content checksum, empty for folders |
filesize | bigint | file size |
create_member_id | string | creator's ID |
create_member_name | string | creator's name |
create_dateline | int | file creation time, Unix timestamp in seconds |
last_member_id | string | last modified by ID |
last_member_name | string | last modified by name |
last_dateline | int | last modified time, Unix timestamp in seconds |
thumbnail | string | file thumbnail URL |
lock | int | is the file locked? |
File Download URL
GET /m-api/2/file/open
Request Parameters
Name | Required | Description |
---|---|---|
token | Yes | access token |
mount_id | Yes | library space ID |
fullpath | - | full file path, provide either fullpath or hash |
hash | - | unique file ID, provide either fullpath or hash |
sign | Yes | signature |
Response Format
json
Response
{
"hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"filehash": "ffffffffffffffffffffffffffffffffffffffff",
"filesize": 204800,
"lock": 0,
"uris": [
"http://xxxxxx"
]
}
Field | Type | Description |
---|---|---|
hash | string | unique file ID |
filehash | string | file checksum |
filesize | string | file size |
lock | int | is the file locked? |
uris | array | array of download URLs, typically one URL, valid for 10 minutes |
File Preview URL
GET /m-api/2/file/preview_url
Request Parameters
Name | Required | Description |
---|---|---|
token | Yes | access token |
mount_id | Yes | library space ID |
fullpath | - | full file path, provide either fullpath or hash |
hash | - | unique file ID, provide either fullpath or hash |
watermark | No | 1 to display watermark, default is no watermark |
sign | Yes | signature |
Response Format
json
Response
{
"url": "preview URL"
}
File (Folder) Information
GET /m-api/2/file/info
Request Parameters
Name | Required | Description |
---|---|---|
token | Yes | Access token |
mount_id | Yes | Library space ID |
fullpath | - | Full file path, provide either fullpath or hash |
hash | - | Unique file ID, provide either fullpath or hash |
sign | Yes | Signature |
Response Format
JSON
Response Example
{
"hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"mount_id": 1,
"dir": 0,
"fullpath": "Word文档.doc",
"filename": "Word文档.doc",
"filehash": "ffffffffffffffffffffffffffffffffffffffff",
"filesize": 204800,
"create_member_id": 1,
"create_member_name": "我",
"create_dateline": 1442563789,
"last_member_id": 1,
"last_member_name": "我",
"last_dateline": 1449505954,
"lock": 0,
"preview": "",
"thumbnail": ""
}
Field | Type | Description |
---|---|---|
hash | string | Unique file ID |
mount_id | int | Library space ID |
dir | int | Indicates if it's a folder |
fullpath | string | Full file path |
filename | string | File name |
filehash | string | File content checksum; empty for folders |
filesize | int | File size |
create_member_id | string | ID of file creator |
create_member_name | string | Name of file creator |
create_dateline | int | File creation timestamp (Unix time in seconds) |
last_member_id | string | ID of last modifier |
last_member_name | string | Name of last modifier |
last_dateline | int | Last modification timestamp (Unix time in seconds) |
preview | string | Preview URI address (To open in a browser, prepend domain http://app.fileshow.com ); not returned for folders |
thumbnail | string | Thumbnail address; not returned for folders |
Number of Files in Folder
Get the number of files and subfolders within a folder, including all sub-items.
GET /m-api/2/file/attribute
Request Parameters
Name | Required | Description |
---|---|---|
token | Yes | Access token |
mount_id | Yes | Library space ID |
fullpath | - | Full file path, provide either fullpath or hash |
hash | - | Unique file ID, provide either fullpath or hash |
dateline | Yes | Current Unix timestamp in seconds |
sign | Yes | Signature |
Response Format
JSON
Response Example
{
"file_count": number of files,
"folder_count": number of subfolders
}
Create Folder
POST /m-api/2/file/create_folder
Request Parameters
Name | Required | Description |
---|---|---|
token | Yes | Access token |
mount_id | Yes | Library space ID |
fullpath | No | Complete folder path |
overwrite | No | Default 1 to overwrite; 0 to auto-rename if folder exists |
dateline | Yes | Current Unix timestamp in seconds |
sign | Yes | Signature |
Upload File
Upload file in chunks.
Step 1: Request Upload
POST /m-api/2/file/create_file HTTP/1.1
Request Parameters
Parameter | Required | Description |
---|---|---|
token | Yes | Access token |
mount_id | Yes | Library space ID |
fullpath | Yes | Full file path |
filehash | Yes | SHA1 hash of file content (40 bytes, lowercase English letters, not included in signature calculation) |
filesize | Yes | File size (not included in signature calculation) |
overwrite | No | Whether to overwrite existing file; 1 for overwrite (default 0 no overwrite), append numeric identifier to filename |
sign | Yes | Signature |
Response Format
{
"state": 1 if file is successfully fast-transferred, 0 if need to call chunk upload interface,
"hash": Unique file identifier,
"fullpath": Full file path,
"server": Upload server address
}
Step 2: Chunk Upload
After Step 1
returns state
as 0
,
Refer to documentation: Chunked Upload
Web Upload
Step 1: Get Upload Server
GET /m-api/1/file/upload_server
Request Parameters
Parameter | Required | Description |
---|---|---|
token | Yes | Access token |
mount_id | Yes | Library space ID |
fullpath | Yes | Full path of file to be uploaded |
sign | Yes | Signature |
Response Example
{
"server": Upload server address
}
Step 2: Upload File Content
Use the returned upload server address to compose upload URL.
{upload server}/2/web_upload
Use multipart/form-data
form to upload file.
Request Parameters
Parameter | Required | Description |
---|---|---|
token | Yes | Access token |
mount_id | Yes | Library space ID |
path | Yes | Target path for file upload; e.g., upload to doc folder pass doc , upload to root pass empty string |
name | Yes | File name |
overwrite | No | Whether to overwrite existing file; 1 for overwrite (default 0 no overwrite), append numeric identifier to filename |
filefield | Yes | Fixed value file |
file | Yes | Data of file to be uploaded |
Response Example
Successful HTTP 200
{
"hash": Unique file identifier,
"filesize": File size,
"fullpath": Full file path
}
Error
{
"error_code": Error code,
"error_msg": Error message,
"fullpath": Full file path
}
Copy File
POST /m-api/1/file/copy HTTP/1.1
Request Parameters
Name | Required | Description | |
---|---|---|---|
token | Yes | Access token | |
mount_id | Yes | Source library space ID | |
fullpath | - | Full path of file to be copied; provide either fullpath or fullpaths |
|
fullpaths | - | Copy multiple files, separated by ` | ; provide either fullpathor fullpaths` |
target_mount_id | No | Destination library space ID; if not provided, copy within the same library | |
target_fullpath | Yes | Full path of destination directory | |
overwrite | No | 1 to overwrite existing file (not applicable to folders) |
|
delete_from | No | 1 to delete original file after copying; mainly used for cross-library file moving |
|
sign | Yes | Signature |
Response Example
Successful HTTP 200
Move File
Note: Only allowed within the same library
POST /m-api/1/file/move HTTP/1.1
Request Parameters
Name | Required | Description | |
---|---|---|---|
token | Yes | Access token | |
mount_id | Yes | Library space ID | |
fullpath | - | Full path of file to be moved; provide either fullpath or fullpaths |
|
fullpaths | - | Move multiple files, separated by ` | ; provide either fullpathor fullpaths` |
target_fullpath | Yes | Full path of target directory | |
sign | Yes | Signature |
Response Example
Successful HTTP 200
Rename File
POST /m-api/1/file/rename HTTP/1.1
Request Parameters
Name | Required | Description |
---|---|---|
token | Yes | Access token |
mount_id | Yes | Library space ID |
fullpath | Yes | Full file path |
newname | Yes | New file name |
sign | Yes | Signature |
Response Example
Successful HTTP 200
Delete File
POST /m-api/1/file/del HTTP/1.1
Request Parameters
Name | Required | Description |
---|---|---|
token | Yes | Access token |
mount_id | Yes | Library space ID |
fullpath | Yes | Full file path |
sign | Yes | Signature |
Response Example
Successful HTTP 200
Add File to Favorites
POST /m-api/1/favorites/add_file HTTP/1.1
Request Parameters
Name | Required | Description |
---|---|---|
token | Yes | Access token |
mount_id | Yes | Library space ID |
fullpath | Yes | Full file path |
fav_id | Yes | Favorites ID, -1 for default favorites |
sign | Yes | Signature |
Response Example
Successful HTTP 200
Remove from Favorites
POST /m-api/1/favorites/del_file HTTP/1.1
Request Parameters
Name | Required | Description |
---|---|---|
token | Yes | Access token |
mount_id | Yes | Library space ID |
fullpath | Yes | Full file path |
fav_id | Yes | Favorites ID, use -1 for the default favorites |
sign | Yes | Signature |
Response Example
Successful HTTP 200
List Files in Favorites
GET /m-api/1/favorites/get_files
Request Parameters
Name | Required | Description |
---|---|---|
token | Yes | Access token |
fav_id | Yes | Favorites ID, use -1 for the default favorites |
start | No | Start position, default is 0 |
size | No | Number of items to retrieve, default is 100 |
sign | Yes | Signature |
Response Format
JSON
Response Example
{
"list": [
{
"mount_id": 1,
"hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"dir": 1,
"fullpath": "Public Resources",
"filename": "Public Resources",
"filehash": "",
"filesize": 0,
"create_member_id": "1",
"create_member_name": "Me",
"create_dateline": 1452569732,
"last_member_id": "1",
"last_member_name": "Me",
"last_dateline": 1452569732
},
{
"hash": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"mount_id": 1,
"dir": 0,
"fullpath": "Word Document.doc",
"filename": "Word Document.doc",
"filehash": "ffffffffffffffffffffffffffffffffffffffff",
"filesize": 204800,
"create_member_id": "1",
"create_member_name": "Me",
"create_dateline": 1442563789,
"last_member_id": "1",
"last_member_name": "Me",
"last_dateline": 1449505954
},
......
]
}
Field | Type | Description |
---|---|---|
hash | string | Unique file ID |
mount_id | int | Library space ID |
dir | int | Indicates if it's a folder |
fullpath | string | Full file path |
filename | string | File name |
filehash | string | File content checksum; empty for folders |
filesize | bigint | File size |
create_member_id | string | ID of file creator |
create_member_name | string | Name of file creator |
create_dateline | int | File creation timestamp (Unix time in seconds) |
last_member_id | string | ID of last modifier |
last_member_name | string | Name of last modifier |
last_dateline | int | Last modification timestamp (Unix time in seconds) |
File Search
GET /m-api/2/file/search
Request Parameters
Name | Required | Description |
---|---|---|
token | Yes | Access token |
keyword | Yes | Search keyword |
mount_id | Yes | Library space ID, use 0 for a global search |
fullpath | No | Search for files within a specified folder, including all subfolders |
scope | No | Search scope, content as JSON; convert to string for the request, e.g., ["filename","tag","content"] . filename searches for file names, tag searches tags, content searches document content. Combinations are allowed, e.g., ["tag","content"] searches both tags and content. Default is ["filename","tag"] |
ext | No | Search for specific types of files/folders, content as JSON; convert to string for the request, e.g., ["dir", "file", "docx", "jpg", ...] . dir searches only folders, file searches only files, other extensions specify the file types to search for |
start | No | Start position, default is 0 |
size | No | Number of items to retrieve, default is 100 |
sign | Yes | Signature |
Response Example
Same as File List