Direct Access to Wialon works if you post queries by the following method. You will need Jquery.
var server_error = [];
server_error[0] = "Successful operation";
server_error[1] = "Invalid session";
server_error[2] = "Invalid service name";
server_error[3] = "Invalid result";
server_error[4] = "Invalid input";
server_error[5] = "Error performing request";
server_error[6] = "Unknown error";
server_error[7] = "Access denied";
server_error[8] = "Invalid user name or password";
server_error[9] = "Authorization server is unavailable";
server_error[10] = "Reached limit of concurrent requests";
server_error[1001] = "No messages for selected interval";
server_error[1002] = "Item with such unique property already exists";
server_error[1003] = "Only one request is allowed at the moment";
var sess = wialon.core.Session.getInstance(), sid = sess.getId(), hostUrl = sess.getBaseUrl();
function syscom(svc, params, variable, fn) {
$.ajax({
timeout: 5000,
url: hostUrl + "/wialon/ajax.html?sid=" + sid,
data: {
svc: svc,
params: JSON.stringify(params)
},
type: 'post',
dataType: 'jsonp',
jsonp: 'callback',
success: function(d) {
window[variable] = d
console.log(d)
if (d.error) {
console.log(server_error[d.error]);
}
if (d.error) {
console.log(server_error[d.error])
return
}
if (typeof fn == 'function') fn();
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(XMLHttpRequest);
console.log(errorThrown);
console.log(textStatus);
}
})
}
Your query
http://********/wialon/ajax.html?sid=ca81753899425965bc078c1d3df674d4&svc=core/search_item¶ms={"id":16174,"flags":1}
would be run like this.
syscom("core/search_item", {
"id": 16174,
"flags": 1
}, 'sysquery', function() {
console.log(sysquery)
})
Please note: that this method is limited to queries with a maximum string length of 2083 characters.
Have fun
Cheers
Nishad Hussain Kaippally
Implementation Specialist, Middle East, Gurtam
"Computer science is no more about computers than astronomy is about telescopes."