<portalConfig_uri>/departments[.<format>]
departmentName、moveDepartment、departmentMembers、departmentAdmins
The departments resource represents the organization structure settings information. By sending GET request, you can get all departments information in organization. By sending POST request, you can add a department. By PUT request, you can simulating DELETE to delete a department and its sub departments. Batch remove is supported.
Supported Methods:
Supported output formats: rjson, json, html, xml.
Implement the HTTP request on the following URI, where supermapiserver is the server name, with rjson being the output format.
http://supermapiportal:8090/iportal/manager/iportalconfig/departments.rjson
Gets all organized departments information in portal.
If the parameter has not been set, it returns all departments by created time in ascending order. If the parameter has been set, returns organized departments information by parameter. parameter shall be contained in request URI.
Field | Type | Description |
orderBy | DepartmentOrderBy | Searches by department order field. |
orderType | OrderType | Query according to sort ascending/descending order. |
Execute GET request on the departments resource. The returned list information of all organized departments in portal consists of following fields:
Field | Type | Description |
childs | List<DepartmentLinkedNode> | Child departments of this department. |
id | Integer | ID of department. |
name | String | Name of the department. |
createTime | long | Department created time. |
orderNum | Integer | Department order number, used as order field. |
Perform the GET request on the departments resource: http://localhost:8090/iportal/manager/iportalconfig/departments.rjson to get all organized departments information. The returned rjson resource representation is as follows:
[
{
"childs": [
{
"childs": [],
"createTime": 1487663516907,
"id": 2,
"name": " Environmental Protection Bureau of county A",
"orderNum": 11
},
{
"childs": [],
"createTime": 1487663531869,
"id": 3,
"name": " Environmental Protection Bureau of county B",
"orderNum": 12
}
],
"createTime": 1487663320292,
"id": 1,
"name": " Environmental Protection Bureau of city A",
"orderNum": 1
}
]
If you are to get specified departments list information,such as a list ordered by orderNum descendingly, set parameters as: orderBy=orderNum,orderType=DESC. That means: Execute GET request on departments resource: http://localhost:8090/iportal/manager/iportalconfig/departments.rjson?orderBy=orderNum&orderType=DESC. The returned resource representation in rjson format is as follows:
[
{
"childs": [
{
"childs": [],
"createTime": 1487663531869,
"id": 3,
"name": " Environmental Protection Bureau of county B",
"orderNum": 12
},
{
"childs": [],
"createTime": 1487663516907,
"id": 2,
"name": " Environmental Protection Bureau of county A",
"orderNum": 11
}
],
"createTime": 1487663320292,
"id": 1,
"name": " Environmental Protection Bureau of city A",
"orderNum": 1
}
]
Adds a department.
Following arguments need to be passed in the request sent.
Name | Type | Description |
name | String | Department name. |
parentId | Integer | ID of Superior department of the newly added department. |
orderNum | Integer | Department order number, used as order field. |
The structure of the response resource representation is as follows:
Field | Type | Description |
postResultType | PostResultType | Adds a department. |
newResourceID | String | The newly added department ID. |
succeed | boolean | Whether it is successful to add a new department. |
newResourceLocation | String | The newly added department url. |
Implement POST request on the departments resource: http://localhost:8090/iportal/manager/iportalconfig/departments.rjson to add a department. Request body is as follows:
{
"name": " Environmental Protection Bureau of county C",
"orderNum": 16,
"parentId": 1
}
The response result in rjson format returned is as follows:
{
"postResultType": "CreateChild",
"newResourceID": "5",
"succeed": true,
"newResourceLocation": "http://192.168.120.40:8090/iportal/manager/iportalconfig/departments/5.json"
}
Simulating DELETE to remove a department and its sub departments. Batch remove is supported. ID Array of departments need to be removed need to be passed in request body.
The structure of the response resource representation is as follows:
Field | Type | Description |
succeed | boolean | Whether it is successful to delete a new department. |
error | Httperror | Error information. This field will not be displayed if the department is deleted successfully. |
Implement POST request on the departments resource: http://localhost:8090/iportal/manager/iportalconfig/departments.rjson to add a department. Request body is as follows:
[5]
The returned resource representation in rjson format is as follows:
{"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 contained 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 whether the departments resource exists, or whether the the client has the permission to access it. It can also determine if the departments resource supports an output format <format> if performed on a URI with .<format> included.