Retrieve a specified map |
Execute GET request to the url below to get all the public maps in current iPortal, where, 192.168.15.118 is the ip of the iPortal host.
http://192.168.15.118:8190/iportal/web/maps.json
To retrieve the information of a specified map, for example to filter according to the map author and map name keyword, you need to set the related parameters (see: GET request of the maps resource), the reference url is as follows:
http://192.168.15.118:8190/iportal/web/maps.json?userNames=[“admin”]&keywords=[“china”]
To retrieve non-public map information, the token value needs to be added at the end of the parameters, for example:
http://192.168.15.118:8190/iportal/web/maps.json?userNames=[“admin”]&keywords=[“china”]&token=tokenvalue
The request code is as follows:
var xhr = new XMLHttpRequest();
xhr.open("GET", url, true);
xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
xhr.onreadystatechange = function () {
var readyState = xhr.readyState;
if (readyState == 4) {
var status = xhr.status;
var tehValue = eval('(' + xhr.responseText + ')');
console.log(tehValue);
xhr.onreadystatechange = function () { };
xhr = null;
}
};
xhr.send();
The structure of the retrieved map information:
Name |
Type |
Description |
content |
List<ViewerMap> |
The page content. |
currentPage |
int |
The number of the current page. |
pageSize |
int |
The number of items in each page. |
searchParameter |
SearchParameter |
The search parameters. |
total |
int |
The total records. |
totalPage |
int |
The total pages. |