SuperMap 云套件文件管理接口说明

SuperMap 云套件文件管理接口说明

云套件文件管理工具使用的是 angular-filemanager,其 API 文档位于 file-manager 容器的"/var/www/htm/API.md"。

1、接口说明

目录下文件列表 (Method: POST)

Request content

json 复制代码
{
    "action": "list",
    "path": "/public_html"
}

Response

json 复制代码
{ "result": [ 
    {
        "name": "magento",
        "rights": "drwxr-xr-x",
        "size": "4096",
        "date": "2024-03-03 15:31:40",
        "type": "dir"
    }, 
    ...
]}

重命名文件/文件夹 (Method: POST)

Request content

json 复制代码
{
    "action": "rename",
    "item": "/public_html/index.php",
    "newItemPath": "/public_html/index2.php"
}

Response

json 复制代码
{ "result": { "success": true, "error": null } }

移动文件/文件夹 (Method: POST)

Request content

json 复制代码
{
    "action": "move",
    "items": ["/public_html/libs", "/public_html/config.php"],
    "newPath": "/public_html/includes"
}

Response

json 复制代码
{ "result": { "success": true, "error": null } }

拷贝文件/文件夹 (Method: POST)

Request content

json 复制代码
{
    "action": "copy",
    "items": ["/public_html/index.php", "/public_html/config.php"],
    "newPath": "/includes",
    "singleFilename": "renamed.php" <-- (only present in single selection copy)
}

Response

json 复制代码
{ "result": { "success": true, "error": null } }

删除文件/文件夹 (Method: POST)

Request content

json 复制代码
{
    "action": "remove",
    "items": ["/public_html/index.php"],
}

Response

json 复制代码
{ "result": { "success": true, "error": null } }

编辑文件 (Method: POST)

Request content

json 复制代码
{
    "action": "edit",
    "item": "/public_html/index.php",
    "content": "<?php echo random(); ?>"
}

Response

json 复制代码
{ "result": { "success": true, "error": null } }

获取文件内容 (Method: POST)

Request content

json 复制代码
{
    "action": "getContent",
    "item": "/public_html/index.php"
}

Response

json 复制代码
{ "result": "<?php echo random(); ?>" }

创建文件夹 (Method: POST)

Request content

json 复制代码
{
    "action": "createFolder",
    "newPath": "/public_html/new-folder"
}

Response

json 复制代码
{ "result": { "success": true, "error": null } }

设置权限 (Method: POST)

Request content

json 复制代码
{
    "action": "changePermissions",
    "items": ["/public_html/root", "/public_html/index.php"],
    "perms": "rw-r-x-wx",
    "permsCode": "653",
    "recursive": true
}

Response

json 复制代码
{ "result": { "success": true, "error": null } }

压缩文件 (Method: POST)

Request content

json 复制代码
{
    "action": "compress",
    "items": ["/public_html/photos", "/public_html/docs"],
    "destination": "/public_html/backups",
    "compressedFilename": "random-files.zip"
}}

Response

json 复制代码
{ "result": { "success": true, "error": null } }

解压文件 (Method: POST)

Request content

json 复制代码
{
    "action": "extract",
    "destination": "/public_html/extracted-files",
    "item": "/public_html/compressed.zip",
    "folderName": "extract_dir"
}

Response

json 复制代码
{ "result": { "success": true, "error": null } }

上传文件 (Method: POST, Content-Type: multipart/form-data)

Http post request payload

复制代码
Content-Disposition: form-data; name="file-0"; filename="github.txt"

Response

json 复制代码
{ "result": { "success": true, "error": null } }

注意:上传文件无数量限制,文件将依次编号为file-0、file-1、...、file-n。

下载/预览文件 (Method: GET)

Http query params

复制代码
[fileManagerConfig.downloadFileUrl]?action=download&path=/public_html/image.jpg

Response

复制代码
-File content

下载(多个)文件 (Method: GET)

Request content

json 复制代码
{
    "action": "downloadMultiple",
    "items": ["/public_html/image1.jpg", "/public_html/image2.jpg"],
    "toFilename": "multiple-items.zip"
}}

Response

复制代码
-File content

2、调用云套件文件管理上传接口测试示例

因为云套件的文件管理需要有 token 才能访问,获取云套件 access_token 可参考帮助文档。具体使用参考如下图:

使用文件上传作为案例测试,将本地文件上传到2025目录下。

调用上传文件接口前2025目录详情:

Postman 测试:

调用上传文件接口后2025目录详情:

相关推荐
Bonnie37312 小时前
云边端一体化解析-什么是云边端,为何能成为AI基础设施核心
人工智能·程序人生·云原生·个人开发
江畔何人初12 小时前
Docker、containerd、CRI、shim 之间的关系
运维·docker·云原生·容器·kubernetes
2401_8916558115 小时前
Git + 云原生:如何管理K8s配置版本?
git·云原生·kubernetes
Volunteer Technology17 小时前
zookeeper基础应用与实战二
分布式·zookeeper·云原生
不吃香菜kkk、18 小时前
夜莺n9e+监控K8s集群+自定义监控页面
运维·云原生·云计算
匀泪18 小时前
云原生(docker私有仓库)
云原生
匀泪19 小时前
云原生(docker网络)
docker·云原生·容器
飞火流星0202719 小时前
常见的k8s平台功能对比、界面一览及KubeSphere安装、Rancher‌安装
云原生·容器·kubernetes·主流k8s平台·主流k8s平台功能对比·k8s在线安装·k8s离线安装
Bonnie37319 小时前
云边端一体化架构:三大组件(云、边、端)的分工与协同逻辑
人工智能·程序人生·云原生·架构·个人开发
tianyagukechat20 小时前
terraform部署阿里云ECS实例演示
云原生·terraform