fileList


URI

<fileManager_uri>/list[.<format>]

Supported methods

GETDELETEHEAD

Parent resource

fileManager

Introduction

fileList reource is used to get the list of files by the specified file type and the folders list in the specified path. DELETE request is used to delete a file or a folder in the specified file path under the publishPath directory,which resides in SuperMap iPortal_HOME%\webapps\iportal directory or  %SuperMap iServer_HOME%\webapps\iserver directory.

Supported Methods:

Supported output formats: rjson, json, xml.

Resource hierarchy

HTTP request methods

Implement the HTTP request on the following URI, where supermapiserver is the server name, with rjson being the output format.

http://supermapiserver:8090/iserver/manager/filemanager/list.rjson?path=../../samples/data/Realspace&filters=*.smwu

GET request

Get the list of the specified-type files or the folder list.

Request parameter

Parameters in the URI:

Name Type Description
path String [Required parameter]
File path, like path = ../../Samples/data.
Both absolute path or relative path are OK. The starting position of relative path is the application directory of iServer.
filters String [Optional parameter]
The file type filter supports multiple formats of filters, such as filters = *.smwu, or filters = *.smwu;*sxwu.
Default is null, which displays all the files and folders under the current path.

Response structure

If the files or folders to be queried under the target path exist, the server will return the file list information, which consists of the following fields:

Field Type Description
fileName String Name of file or folder directory.
filePath String Absolute path of file or folder directory.
fileSize long File size. If the listed information is about folder directory, then the file size is 0 bytes by default.
isDirectory boolean Whether it is the folder directory, and the default is false.

If the files or folders to be queried under the target path don't exist, then the response consists of the following fields:

Field Type Description
succeed boolean Analyze whether it is successful, here is false.
error HttpError If the specified file or folder directory doesn't exist, then return an error and the response code is 400, for example,

"error": {

    "code": 400,

    "errorMsg": "folder \\nb\\oo.txt doesn't exist."

}

 

Response example

Send the following request for the local server to check the files or the folder directory under "../../samples/data". Sends a GET request as follows:

http://localhost:8090/iserver/manager/filemanager/list.rjson?path=../../samples/data

The response result in rjson format returned is as follows:

[

    {

        "fileName": "China400",

        "filePath": "../../samples/data/China400/",

        "fileSize": 0,

        "isDirectory": true

    },

    {

        "fileName": "City",

        "filePath": "../../samples/data/City/",

        "fileSize": 0,

        "isDirectory": true

    },

    {

        "fileName": "NetworkAnalyst",

        "filePath": "../../samples/data/NetworkAnalyst/",

        "fileSize": 0,

        "isDirectory": true

    },

    {

        "fileName": "Realspace",

        "filePath": "../../samples/data/Realspace/",

        "fileSize": 0,

        "isDirectory": true

    },

    {

        "fileName": "SpatialAnalyst",

        "filePath": "../../samples/data/SpatialAnalyst/",

        "fileSize": 0,

        "isDirectory": true

    },

    {

        "fileName": "World",

        "filePath": "../../samples/data/World/",

        "fileSize": 0,

        "isDirectory": true

    }

]

Check sxwu or smwu workspace in "../../samples/data/Realspace" according to the above response results, and then send a request as follows:

http://localhost:8090/iserver/manager/filemanager/list.rjson?path=../../samples/data/Realspace&filters=*.sxwu;*.smwu

The response result in rjson format returned is as follows:

[

    {

        "fileName": "Balloon",

        "filePath": "../../samples/data/Realspace/Balloon/",

        "fileSize": 0,

        "isDirectory": true

    },

    {

        "fileName": "BeijingModel.smwu",

        "filePath": "../../samples/data/Realspace/BeijingModel.smwu",

        "fileSize": 2488628,

        "isDirectory": false

    },

    {

        "fileName": "Building@CBD",

        "filePath": "../../samples/data/Realspace/Building@CBD/",

        "fileSize": 0,

        "isDirectory": true

    },

    {

        "fileName": "ConventionCenter@ConventionCenter",

        "filePath": "../../samples/data/Realspace/ConventionCenter@ConventionCenter/",

        "fileSize": 0,

        "isDirectory": true

    },

    {

        "fileName": "Ground_1@CBD",

        "filePath": "../../samples/data/Realspace/Ground_1@CBD/",

        "fileSize": 0,

        "isDirectory": true

    },

    {

        "fileName": "Ground_2@CBD",

        "filePath": "../../samples/data/Realspace/Ground_2@CBD/",

        "fileSize": 0,

        "isDirectory": true

    },

    {

        "fileName": "Lake@CBD",

        "filePath": "../../samples/data/Realspace/Lake@CBD/",

        "fileSize": 0,

        "isDirectory": true

    },

    {

        "fileName": "NightOlympic",

        "filePath": "../../samples/data/Realspace/NightOlympic/",

        "fileSize": 0,

        "isDirectory": true

    },

    {

        "fileName": "OlympicGreen",

        "filePath": "../../samples/data/Realspace/OlympicGreen/",

        "fileSize": 0,

        "isDirectory": true

    },

    {

        "fileName": "RealspaceSample",

        "filePath": "../../samples/data/Realspace/RealspaceSample/",

        "fileSize": 0,

        "isDirectory": true

    },

    {

        "fileName": "RealspaceSample.sxwu",

        "filePath": "../../samples/data/Realspace/RealspaceSample.sxwu",

        "fileSize": 222952,

        "isDirectory": false

    },

    {

        "fileName": "Tree@CBD",

        "filePath": "../../samples/data/Realspace/Tree@CBD/",

        "fileSize": 0,

        "isDirectory": true

    },

    {

        "fileName": "underground",

        "filePath": "../../samples/data/Realspace/underground/",

        "fileSize": 0,

        "isDirectory": true

    }

]

DELETE request

DELETE request is used to delete a file or a folder in the specified file path under the publishPath directory,which resides in SuperMap iPortal_HOME%\webapps\iportal directory or  %SuperMap iServer_HOME%\webapps\iserver directory.

Response structure

Execute DELETE request on fileList, the structure of the returned operation representation is as follows (The representation is in the entity body of the response message) :

Field Type Description
succeed boolean

Indicates the deletion operation successes or fails.

 

Response example

 Execute DELETE request on fileList resource: http://localhost:8090/iserver/manager/filemanager/list.rjson?path=./city0628.zip, to delete the "city0628.zip" file under the publishPath directory, the returned response in rjson format is as follows:

{"succeed": true}

HEAD request

Asks for the response identical to the one that would correspond to a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content. The meta-information includes the media-type, content-encoding, transfer-encoding, content-length, etc.

HEAD request can be used to check if the fileList resource exists, or if the fileList resource can be accessed by clients. It can also determine if the fileList resource supports an output format <format> if performed on a URI with <format> included.

See