API for IoT Device Connectivity

Remote data access for third-party services is available only for open-access devices and is implemented as a URL request to the server. The request can be either GET or POST.

Parameters for getting data for a specific period of time:

The result of the request will be a JSON string with parameters:

Request: https://viziot.com/getdata/?action=getDataOpenDeviceByPeriod&ampampampampampampampampampampampampampampampampampampampampampampampamp;keyPublicDevice=8UNT6XZY9Y6VC48Q5S6HP9JHDK4XVII7UWHJSYU3MLPG&timeStampStart=1613825023&timeStampEnd=1613835023
Response: {"type":"ok","points":[{"date":"1543838492","param":{"f1":"-57","f2":"0.00","f3":"0.00","f4":"0.00","f5":"0.00"}},{"date":"1543838507","param":{"f1":"-56","f2":"0.00","f3":"0.00","f4":"0.00","f5":"0.00"}}]}

Parameters for getting the latest data from the IoT device:

The result of the request will be a JSON string with parameters:

Request: https://viziot.com/getdata/?action=getLastDataOpenDevice&keyPublicDevice=8UNT6XZY9Y6VC48Q5S6HP9JHDK4XVII7UWHJSYU3MLPG
Response: {"type":"ok","point":{"date":"1543839005","param":{"f1":"-56","f2":"0.00","f3":"0.00","f4":"0.00","f5":"0.00"}}}

Data type "point"

Data type "point" consists of two parameters:

JavaScript code example with jQuery library:

function getDataOpenDeviceByPeriod() {
    $.ajax({
        type:"POST",
        dataType:'json',
        url:'https://viziot.com/getdata/',
        timeout: 10000,
        data:{
            'action':'getDataOpenDeviceByPeriod',
            "keyPublicDevice" : "XPHQM555HIB8P7USMGZM7YFLLRMAP7YIFJZQJY0CTSCV",
            "timeStampStart" : parseInt(new Date().getTime()/1000) - (60*60*24),
            "timeStampEnd" : parseInt(new Date().getTime()/1000),
        },
        success: function(json){
            var data = eval(json);
            switch(data.type) {
                case 'ok':
                    console.log('ok', data);
                    break;
                case 'error':
                    console.log("error", data);
                    break;
                default :
                    console.log(json);
            }
        }
    });
}
function getLastDataOpenDevice() {
    $.ajax({
        type:"POST",
        dataType:'json',
        url:'https://viziot.com/getdata/',
        timeout: 10000,
        data:{
            'action':'getLastDataOpenDevice',
            "keyPublicDevice" : "XPHQM555HIB8P7USMGZM7YFLLRMAP7YIFJZQJY0CTSCV",
        },
        success: function(json){
            var data = eval(json);
            switch(data.type) {
                case 'ok':
                    console.log('ok', data);
                    break;
                case 'error':
                    console.log("error", data);
                    break;
                default :
                    console.log(json);
            }
        }
    });
}
$(function(){
    getDataOpenDeviceByPeriod();
    getLastDataOpenDevice();
})