To work with file server resources, execute requests using the "file" API method (before executing the request determine user token).
NOTE. File server resources requests are available on configured connection file server folder.
Load file from server:
curl '<IP address or DNS name of server>/api/v1/file/<mounting name>/?file=sdf/<file name>' -H "Authorization: bearer <user token>"
Example of response:
{
"code": 403,
"description": "User is not authorized to execute this action",
"original_descriptions": []
}
Load file to server:
curl -X PUT '<IP address or DNS name of server>/api/v1/file/<mounting name>/?file=sdf/<name of loaded file>' -H "Authorization: bearer <user token>" --upload-file <relational path of loaded file> -H 'Content-Disposition: inline; filename="<name of loaded file>"'
Example of response:
204 File loaded successfully.
Delete file from server:
curl -X DELETE '<IP address or DNS name of server>/api/v1/file/<mounting name>/?file=sdf/<file name>' -H "Authorization: bearer <user token>"
Example of response:
{
"code": 404,
"description": "Not found",
"original_description": []
}
File information:
curl '<IP address DNS name of server>/api/v1/file/<mounting name>/meta/?file=sdf/<file name>' -H "Authorization: bearer <user token>"
Example of response:
{
"stat": {
"st_mode": 33188,
"st_ino": 7502955,
"st_dev": 2052,
"st_nlink": 1,
"st_uid": 1000,
"st_gid": 1000,
"st_size": 13181,
"st_atime": 1527775186.7419834,
"st_mtime": 1527775066.9299881,
"st_ctime": 1527775066.9299881,
"st_atime_ns": 1527775186741983500,
"st_mtime_ns": 1527775066929988000,
"st_ctime_ns": 1527775066929988000,
"st_blocks": 32,
"st_blksize": 4096,
"st_rdev": 0
}
}
Information about directory contents:
curl '<IP address or DNS name of server>/api/v1/directory/<mounting server>/?directory=sdf' -H "Authorization: bearer <user token>"
Example of response:
{
"directories": [
"hello_dir"
],
"files": [
"<file name_1>",
"<file name_2>",
"<file name_3>"
]
}
See also: