<portal_uri>/directories[.<format>]
The directories resource is the resource manager. With GET request, users (including anonymous users) could get root directory and its directory structure list. The administrator (login status) can create a directory with POST request; the administrator (login status) can delete root directory and its structure list with DELETE request.
Supported Methods:
Supported output formats: rjson, json, html, xml.
Implement the HTTP request on the following URI, where supermapiportal is the server name, with rjson being the output format.
http://supermapiportal:8090/iportal/web/directories.rjson
Get the structure list of the root directory.
Return all directory structure list if the parameter isn't set; Return the specified directory list if the parameter is set, and the parameter must be included in URI.
Name | Type | Description |
dirLevel | Integer | Filtered by the directory level. e.g., "dirLevel":1 represents the root directory. |
parentDirId | Integer | Filtered by the parent directory ID. |
dirType | DirectoryResourceType | Filtered by directory type, such as MAP, SERVICE, SCENE. |
orderBy | DirOrderBy | Filtered by directory order status. e.g., CREATETIME means the time when the directory was created; UPDATETIME means the time when the directory was updated. |
Execute GET request for the directories resource, and return all directory structure list, which is composed of:
Field | Type | Description |
content | List<BasicDirInfo> | Contents of the page. |
currentPage | int | Current page number. |
pageSize | int | Page size. |
searchParameter | SearchParameter | Search parameter on current page. |
total | int | Total records |
totalPage | int | Total pages. |
Execute GET request for directories http://localhost:8090/iportal/web/directories.rjson. By default, it gets all root directory structure list and returns the resource representation with rjson format:
{
"content": [
{
"createTime": 1433125809626,
"description": null,
"dirCreator": "admin",
"dirLevel": 1,
"dirName": "Population Distribution",
"dirType": "MAP",
"icon": null,
"id": 28,
"parentDirId": null,
"updateTime": 1433125809626
},
{
"createTime": 1433125819024,
"description": null,
"dirCreator": "admin",
"dirLevel": 2,
"dirName": "2014",
"dirType": "MAP",
"icon": null,
"id": 29,
"parentDirId": 28,
"updateTime": 1433125819024
},
{
"createTime": 1433125875649,
"description": null,
"dirCreator": "admin",
"dirLevel": 2,
"dirName": "2015",
"dirType": "MAP",
"icon": null,
"id": 30,
"parentDirId": 28,
"updateTime": 1433126268099
},
{
"createTime": 1433126361703,
"description": null,
"dirCreator": "admin",
"dirLevel": 1,
"dirName": "New Directory",
"dirType": "SERVICE",
"icon": null,
"id": 31,
"parentDirId": null,
"updateTime": 1433126361703
}
],
"currentPage": 1,
"pageSize": 0,
"searchParameter": null,
"total": 4,
"totalPage": 0
}
If you need to get the specified directory structure list, filtered by such as directory type and directory level, you have to set dirType=MAP&dirLevel=1, that is, executing GET request for directories resource http://localhost:8090/iportal/web/directories.rjson?dirType=MAP&dirLevel=1, getting all directory structure list with directory type MAP and directory level 1, and retruning the resource representation with rjson format:
{
"content": [
{
"createTime": 1433125809626,
"description": null,
"dirCreator": "admin",
"dirLevel": 1,
"dirName": "Population Distribution",
"dirType": "MAP",
"icon": null,
"id": 28,
"parentDirId": null,
"updateTime": 1433125809626
}
],
"currentPage": 1,
"pageSize": 0,
"searchParameter": null,
"total": 1,
"totalPage": 0
}
Create a new directory.
Following arguments need to be passed in the request sent.
Name | Type | Description |
dirName |
String | [Required] Name of the directory. |
dirType | DirectoryResourceType | Directory type. It is required when creating a root directory. It is optional, if the value is null or the parameter isn't transferred when creating a child directory. By default, the directory type is the same with the parent directory. |
icon | String | [Required] Directory icon. The null value means the parameter will not be transfered. In other words, the directory icon will use the default icon. |
description | String | [Required] Directory description. The null value means the parameter will not be transfered. |
parentDirId | Integer | Parent directory ID. It is optional when creating a child directory; if the value is null or the parameter isn't transferred when creating a child directory. |
The structure of the response resource representation is as follows:
Field | Type | Description |
newResourceID | String | Create new directory ID. |
newResourceLocation | String | Create new directory URI. |
succeed | boolean | Whether the new directory is successfully created or not. |
Execute POST request for directories resource http://localhost:8090/iportal/web/directories.rjson, and create a new root directory, the type is MAP and the name is Land Use. The request body is as follows:
{
"dirName": "Land use",
"dirType": "MAP"
}
The response result in rjson format returned is as follows:
{
"succeed": true,
"newResourceID": "32",
"newResourceLocation": "http://192.168.120.50:3230/iportal/web/directories/32"
}
If you want to create a child directory named 2014 under the root directory Land Use, you need to execute POST request for directories resource http://localhost:8090/iportal/web/directories.rjson and send request body:
{
"parentDirId":"32",
"dirType": "MAP",
"dirName": "2014"
}
The response result in rjson format returned is as follows:
{
"succeed": true,
"newResourceID": "33",
"newResourceLocation": "http://192.168.120.50:3230/iportal/web/directories/33"
}
Delete directory. It is supported to delete directories in batch. The directory and its entity class DeleteDirOrResSetting needs to be deleted in transferring with URL. The entity class contains the following fields:
Field | Type | Description |
ids | List<Integer> | Directory ID collection. The parent directory and its all child directories and resources should be deleted if the parent directory ID is transferred. |
resourceIds | List<Integer> | The resource ID collection under the directory. |
parentDirId | Integer | The parent directory ID. This parameter needs to transfer if you want to delete child directories and resources under the parent directory. |
isDeleteResources | boolean | Whether to delete resources from iPortal. Remove resources from the directory if it is fales; delete resources from the directory if it is true. |
The structure of the response resource representation is as follows:
Field | Type | Description |
succeed | boolean | Whether the directory is successfully deleted or not. |
error | Httperror | Error information. This field will not be displayed if the directory is deleted successfully. |
There are for cases for deleting directories:
Case 1: Delete multiple root directories and their resources
Execute DELETE request for the directory resource http://localhost/iportal/web/directories.rjson?deleteDirOrResSetting={ids:[2,3],isDeleteResources:false}, delete all directory list information with root directory ID 2 and 3 in batch, remove resources from the deleted directory. The returned rjson format response result is as follows:
{ "succeed": true}
Case 2: Delete child directories under the parent directory, and remove resources in the child directories
Execute DELETE request for the directory resource http://localhost/iportal/web/directories.rjson?deleteDirOrResSetting={ids:[2,3],parentDirId:6,isDeleteResources:false}, delete all directory list information with child directory ID 2 and 3 under the parent directory 6 in batch, remove resources from the deleted directory. The returned rjson format response result is as follows:
{ "succeed": true}
Case 3: Remove resources under the directory
Execute DELETE request for directories http://localhost/iportal/web/directories.rjson?deleteDirOrResSetting={resourceIds:[10,11],parentDirId:11,isDeleteResources:false}, remove resources with ID 10 and 11 from the parent directory with ID 11 in batch. The returned rjson format response result is:
{ "succeed": true}
Case 4: Delete child directories under the parent directory, and remove resources under the parent directory and child directories.
Execute DELETE request for directories resource http://localhost/iportal/web/directories.rjson?deleteDirOrResSetting={ids:[8,10],resourceIds:[10,11],parentDirId:11,isDeleteResources:false}, delete the child directories with ID 8 and 9 under the parent directory with ID 11 in batch and remove resources under the child directories and remove all resources under the parent directory with ID 10 and 11, and return the result with rjson format:
{ "succeed": true}
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 directories resource exists, or if the directories resource can be accessed by clients. It can also determine if the directories resource supports an output format <format> if performed on a URI with .<format> included.