美文网首页
Storage-file-CRUD

Storage-file-CRUD

作者: Orange_____ | 来源:发表于2020-08-10 13:59 被阅读0次

    存储下文件的文件相关API声明

    1.list文件 (GET /api/v0/storage/{id}/files;directory={directory})

    1.1 demo

    request -> /api/v0/storage/1/directories;directory=/home/test

    response ->

    {
        "content": [{
            "storageId": 1,
            "storageType": "NAS",
            "protocol": "NFS",
            "name": "Video",
            "isDirectory": true,
            "hasChildren": true,
            "parentDirectory": "/home/test",
            "path": "/home/test/Video",
            "modifiedAt": "2012-02-33",
            "size": "--",
            "owner": "test",
            "children": []
        }, {
            "storageId": 1,
            "storageType": "NAS",
            "protocol": "NFS",
            "name": ".bashrc",
            "isDirectory": false,
            "hasChildren": false,
            "parentDirectory": "/home/test",
            "path": "/home/test/.bashrc",
            "modifiedAt": "2012-02-33",
            "size": "60KB",
            "owner": "test",
            "children": []
        }],
        "pageable": {
            "sort": {
                "unsorted": false,
                "sorted": true,
                "empty": false
            },
            "pageNumber": 0,
            "pageSize": 1000,
            "offset": 0,
            "paged": true,
            "unpaged": false
        },
        "totalPages": 1,
        "totalElements": 6,
        "last": true,
        "first": true,
        "number": 0,
        "sort": {
            "unsorted": false,
            "sorted": true,
            "empty": false
        },
        "numberOfElements": 6,
        "size": 1000,
        "empty": false
    }
    

    2. 创建空文件夹 (POST /api/v0/storage/{id}/directories)

    2.1 demo

    request -> /api/v0/storage/1/directories

    {
        "parentDirectory": "/home",
        "name": "foo"
    }
    

    3. 删除文件(file/directory) (DELETE /api/v0/storage/{id}/files;path={/test/a.txt})

    4. 上传文件(only file) (PUT /api/v0/storage/{id}/files/blob;path={/test/a.txt})

    5. 下载文件(only file) (GET /api/v0/storage/{id}/files/blob;path={/test/a.txt})

    相关文章

      网友评论

          本文标题:Storage-file-CRUD

          本文链接:https://www.haomeiwen.com/subject/zzzddktx.html