|
ENDPOINTS
WebServer provides specific endpoints to GET and POST data.
|
/way
|
GET - IDENTIFICATION
|
|
Returns WebId and device name.
|
|
$.ajax({
url: '/way',
type: 'GET',
timeout: 4000,
success: function(data, status) {
//called when successful
},
error: function(request, status, message) {
//called when there is an error
}
});
|
|
The data returned on successful request is the device identifier (WebId) and the given name.
|
|
/login
|
POST - LOGIN
|
|
Send command to device
|
|
$.ajax({
url: '/login', // endpoint
type: 'POST', // method
timeout: 4000,
data: 0000, // device password
success: function(data, status) {
//called when successful
},
error: function(request, status, message) {
//called when there is an error
}
});
|
|
The answer is OK (access granted) or ERROR (bad password).
|
Access to further endpoints is granted after successfully login.
At the request of one of the following endpoints without having first logged in, the device will return the HTTP status: 401 Unauthorized
|
/cmd
|
POST - COMMANDS
|
|
Send command to device
|
|
$.ajax({
url: '/cmd', // endpoint
type: 'POST', // method
timeout: 4000,
data: command, // command to be sent
success: function(data, status) {
//called when successful
},
error: function(request, status, message) {
//called when there is an error
}
});
|
|
The answer is OK or ERRORdata returned on successful request is the response to the command, the same returned when the command is sent through the console.
Some commands are not allowed from this endpoint.
|
|
/readuser
|
GET - USERS LIST
|
|
Returns the list of operations stored within the device log file.
|
|
$.ajax({
url: '/readlog',
type: 'GET',
timeout: 4000,
success: function(data, status) {
//called when successful
},
error: function(request, status, message) {
//called when there is an error
}
});
|
|
The data returned on successful request is the unordered list of all users stored into the device memory.
|
|
/readlog
|
GET - LOG FILE
|
|
Returns the list of operations stored within the device log file.
|
|
$.ajax({
url: '/readlog',
type: 'GET',
timeout: 4000,
success: function(data, status) {
//esegue in caso di successo
},
error: function(request, status, message) {
//esegue in caso di errore
}
});
|
|
The data returned on successful request is the log stored into the device memory.
|
|
/readmap
|
GET - DEVICE MAP
|
|
Returns configuration and status of each device resource stored into the map file.
|
|
$.ajax({
url: '/readmap',
type: 'GET',
timeout: 4000,
success: function(data, status) {
//called when successful
},
error: function(request, status, message) {
//called when there is an error
}
});
|
|
The data returned on successful request is complete device map represented as TAGVALUE
|
|
/readrule
|
POST - RULE LIST
|
|
Returns complete or partial rule list.
POST the interval in the range 1…500
|
|
$.ajax({
url: '/readrule',
type: 'POST',
timeout: 4000,
data: "1,100", // interval
success: function(data, status) {
//called when successful
},
error: function(request, status, message) {
//called when there is an error
}
});
|
|
The data returned is the list of rules stored into the unit within the specified interval.
|
|
/list
|
GET - FILE LIST
|
|
Rende l'elenco dei files presenti nel dispositivo
|
|
$.ajax({
url: '/list',
type: 'GET',
timeout: 4000,
success: function(data, status) {
///called when successful
},
error: function(request, status, message) {
//called when there is an error
}
});
|
|
The data returned on successfully request is a list of path and filename.
|
|
/read
|
GET - RETRIEVE FILE
|
|
Retrieves a file from the device specifying the full path.
|
|
$.ajax({
url: '/read/' + filename,
type: 'GET',
timeout: 4000,
success: function(data, status) {
//called when successful
},
error: function(request, status, message) {
//called when there is an error
}
});
|
|
The data returned on successfully request is the content of the file.
|
|
/upload
|
POST - STORE FILE
|
|
Store a file into the device filesystem specifying the full path.
|
|
$.ajax({
url: '/upload/' + filename,
type: 'POST',
data: file, // file content to be stored
timeout: 4000,
success: function(data, status) {
//called when successful
},
error: function(request, status, message) {
//called when there is an error
}
});
|
|
There is no data in return, the operation is successfully completed when file has been stored.
|
|
/audio
|
POST - STORE AUDIO FILE
|
|
Store an audio file into the device disk P.
|
|
$.ajax({
url: '/upload/' + size + '/' + filename,
type: 'POST',
data: file, // audio file content to be stored
timeout: 4000,
success: function(data, status) {
//called when successful
},
error: function(request, status, message) {
//called when there is an error
}
});
|
|
There is no data in return, the operation is successfully completed when file has been stored.
|
|
/delete
|
GET - DELETE FILE
|
|
Delete a file within the device filesystem specifying the full path.
|
|
$.ajax({
url: '/delete/' + filename,
type: 'GET',
timeout: 4000,
success: function(data, status) {
//called when successful
},
error: function(request, status, message) {
//called when there is an error
}
});
|
|
There is no data in return, the operation is successfully completed when file has been deleted.
|
CORS
CORS requests are supported, so it is possible to access the endpoints also from the outside, by specifying the IP address of the device, below is an example of a request made by any device present in the same network as an Avior with address 10.0.0.88.
|
/way
|
GET - IDENTIFICATION
|
|
Returns WebId and device name.
|
|
$.ajax({
url: '10.0.0.88/way',
type: 'GET',
timeout: 4000,
success: function(data, status) {
//called when successful
},
error: function(request, status, message) {
//called when there is an error
}
});
|
|
The data returned on successful request is the device identifier (WebId) and the given name.
|
In this way it will be possible to interact with an Avior belonging to local network without using the pages hosted on the SD card.
|