SensorAPI

Prerequisites

Welcome to the SensorAPI that provides interface to our sensor testbed. It is designed as a REST web service. Due to read-only nature of the data only GET methods are implemented and accessible for the user.

At the moment only XML is used as internet media type.

Getting started

Requests to the web service can be triggered from mash-up javascript applications, PHP framework or any other software.

Here is an example of JavaScript/jQuery code that handles one of our requests:

function loadedKeywords(data) {
  var HTML = "";
  $(data).find("keyword").each(function() {
    var keyword = $(this);
    var keywordName = keyword.attr("name");                    
    var weight = keyword.attr("weight");
    size = Math.round(weight * 50) + 8;                    
    HTML += "<font style=\"font-size: " + size + "px\"><a href=\"javascript:filterByKeyword('" + keywordName + "');\">" + keywordName + "</a></font> ";                                                            
  });
  $("#div-keywords").html(HTML);
}
$(function() {
  // keyword cloud
  $.ajax({
    url: 'http://sensors.ijs.si/xml/get-keywords',
    success: loadedKeywords
  });
});

If you decide to use our API, you are kindly invited to let us know about it.

Error reporting

In case an error occurs while processing a request an XML is returned, that contains description of the error.

XML looks like this:

<errors>
  <error>
    Description of the error.
  </error>
</errors> 

Reference

XML response description in this reference contains XML tree explaination. In the tree the bold nodes represent an XML element and normal (non-bold) nodes represent element attributes.

Data Types

int

integer

float

real number

string

string

date

MySQL-like date string formatted as YYYY-MM-DD

time

MySQL-like datetime string formatted as YYYY-MM-DD hh:mm:ss

duration_type

integer, representing duration period:

sensors-on-node

Returns list of sensor_ids (sensors), installed on the node.

Parameters:

Result: XML 

HTTP request: http://sensors.ijs.si/xml/sensors-on-node/par1

XML response description:

node-from-sensor

Returns node_id from provided sensor_id.

Parameters:

Result: XML 

HTTP request: http://sensors.ijs.si/xml/node-from-sensor/par1

XML response description:

sensor-type

Returns sensor type (including feature of measurement and unit of measurement to the user). Same info is also included in current-state.

Parameters:

Result: XML 

HTTP request: http://sensors.ijs.si/xml/sensor-type/par1

XML response description:

current-state

Returns data about all nodes, sensors installed on them and the most recent timestamped measurements.

Parameters: none
Result: XML 

HTTP request: http://sensors.ijs.si/xml/current-state

XML response description:

get-measurements

Parameters:

Result: XML

HTTP request: http://sensors.ijs.si/xml/get-measurements/par1:par2:par3:par4

XML response description:

get-keywords

Returns keywords (feature of measurement) and their weight (according to their frequency).

Parameters: none
Result: XML 

HTTP request: http://sensors.ijs.si/xml/get-keywords

XML response description:

get-clusters

Returns clusters of nodes, enriched with Wikipedia and Geonames data.

Parameters: none
Result: XML 

HTTP request: http://sensors.ijs.si/xml/get-clusters

XML response description:

Examples

Check: http://sensors.ijs.si