Feeder and Provider module
Controller Servlet
Controller servlet allows to login to SensLog and to send further requests.
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/ControllerServlet</td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>POST</td>
<td>Request provides users to login to the SensLog</td>
<td>KVP text/plain </td>
</tr>
</tbody>
</table>
Important notes:
HTTP Post request has to contain a Header with value:
Content-Type: application/x-www-form-urlencoded
Example of payload:
username=test&password=demo
Example of correct response:
{"sessionid":"rv6pe5o30091","language":"en","audio":"false"}
Example of HTTP Header <var>Cookie</var> to be added to any further requests:
Cookie: JSESSIONID=rv6pe5o30091; sessionid=rv6pe5o30091; language=en; audio=false
Feeder Servlet
Feeder Servlet allows to insert observations, units positions and alerts.
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/FeederServlet?Operation=<var>operationName</var></td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Provides insertion of main collected objects</td>
<td>URL encoded text/plain</td>
</tr>
</tbody>
</table>
InsertObservation
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/FeederServlet?Operation=InsertObservation</td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Provides inserting of new observation for combination of sensor and unit into database. Return true if observation was successfully inserted, false in all other cases.</td>
<td>URL encoded text/plain</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th>Parameter</th>
<th>Format</th>
<th>Role</th>
</tr>
<tr>
<td>value</td>
<td>Double precision</td>
<td>Measured value (mandatory)</td>
</tr>
<tr>
<td>date</td>
<td>Time stamp (ISO 8601)</td>
<td>Timestamp of measured value (e.g. 2015-07-15 12:00:00+0200) (mandatory)</td>
</tr>
<tr>
<td>unit_id</td>
<td>Numerical value</td>
<td>Identifier of unit (mandatory)</td>
</tr>
<tr>
<td>sensor_id</td>
<td>Numerical value</td>
<td>Identifier of sensor (mandatory)</td>
</tr>
</tbody>
</table>
InsertPosition
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/FeederServlet?Operation=InsertPosition</td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Provides inserting of new unit position in the database, position can be inserted only as WGS-84 coordinates. Return true if position was inserted successfully, false in all other cases.</td>
<td>URL encoded text/plain</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th>Parameter</th>
<th>Format</th>
<th>Role</th>
</tr>
<tr>
<td>lat</td>
<td>Double precision</td>
<td>Latitude (mandatory)</td>
</tr>
<tr>
<td>lon</td>
<td>Double precision</td>
<td>Longitude (mandatory)</td>
</tr>
<tr>
<td>alt</td>
<td>Double precision</td>
<td>Altitude in meters (optional)</td>
</tr>
<tr>
<td>speed</td>
<td>Double precision</td>
<td>Speed of the unit (optional)</td>
</tr>
<tr>
<td>unit_id</td>
<td>Numerical value</td>
<td>Identifier of unit (mandatory)</td>
</tr>
<tr>
<td>date</td>
<td>Timestamp (ISO 8601)</td>
<td>Timestamp of measured value (e.g. 2015-07-15 12:00:00+0200) (mandatory)</td>
</tr>
<tr>
<td>dop</td>
<td>Numerical value</td>
<td>Dilution of precision (optional)</td>
</tr>
</tbody>
</table>
InsertAlertEvent
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/FeederServlet?Operation=InsertAlertEvent</td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Provides inserting of new alert event that was detected in the sensor network into database, Return true if event was successfully inserted, false in all other cases.</td>
<td>URL encoded text/plain</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th>Parameter</th>
<th>Format</th>
<th>Role</th>
</tr>
<tr>
<td>alert_id</td>
<td>Numerical value</td>
<td>Identifier of alert (mandatory)</td>
</tr>
<tr>
<td>unit_id</td>
<td>Numerical value</td>
<td>Identifier of unit (mandatory)</td>
</tr>
<tr>
<td>date</td>
<td>Timestamp (ISO 8601)</td>
<td>Timestamp of measured value (e.g. 2015-07-15 12:00:00+0200) (mandatory)</td>
</tr>
</tbody>
</table>
Data Service
Data Service provides information about units and positions of units
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/DataService?Operation=<var>operationName</var></td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Provides detailed information about sensor units</td>
<td>JSON</td>
</tr>
</tbody>
</table>
GetUnits
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/DataService?Operation=GetUnits</td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Provides detailed information about each units connected to login user. Response contains connected sensors, first and last time stamp of entered observation, last positions of units.</td>
<td>JSON</td>
</tr>
</tbody>
</table>
GetUnitsList
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/DataService?Operation=GetUnitsList</td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Provides basic information about each units connected to login user. Response contains identifier of each unit and its description.</td>
<td>JSON</td>
</tr>
</tbody>
</table>
GetPositions
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/DataService?Operation=GetPositions</td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Request provides users specified number of last positions of all units in current group.</td>
<td>JSON</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th>Parameter</th>
<th>Format</th>
<th>Role</th>
</tr>
<tr>
<td>user</td>
<td>Text</td>
<td>Identifier of user group</td>
</tr>
<tr>
<td>limit</td>
<td>Numeric value</td>
<td>Number of positions to receive</td>
</tr>
</tbody>
</table>
GetPositionsDay
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/DataService?Operation=GetPositionsDay</td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Request provides list of positions of specified unit during given time range. Positions can be ordered by timestamp ascending or descending. This method is variable to GetTracks, but providing raw positions as Points rather than tracks as Polylines.</td>
<td>JSON</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th>Parameter</th>
<th>Format</th>
<th>Role</th>
</tr>
<tr>
<td>user</td>
<td>Text</td>
<td>Identifier of user group. (mandatory)</td>
</tr>
<tr>
<td>unit_id</td>
<td>Numeric value</td>
<td>Identifier of unit. (mandatory)</td>
</tr>
<tr>
<td>fromTime</td>
<td>Date (ISO 8601)</td>
<td>Beginning date of the time range. (optional)</td>
</tr>
<tr>
<td>toTime</td>
<td>Date (ISO 8601)</td>
<td>End date of the time range. (optional)</td>
</tr>
<tr>
<td>ordering</td>
<td>Text</td>
<td>Identifier of ordering way. Only values "ascending" and "descending" are allowed. (optional)</td>
</tr>
</tbody>
</table>
GetLastPositions
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/DataService?Operation=GetLastPositions</td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Request provides user last positions of all units in user group.</td>
<td>JSON</td>
</tr>
</tbody>
</table>
GetLastPositionsWithStatus
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/DataService?Operation=GetLastPositionsWithStatus</td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Request provides user information about alert events and other attributes in addition to previous GetLastPositions request.</td>
<td>JSON</td>
</tr>
</tbody>
</table>
GetTracks
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/DataService?Operation=GetTracks</td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Request returns entered number of trajectory geometries of all moving units in user group.</td>
<td>URL encoded text/plain</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th>Parameter</th>
<th>Format</th>
<th>Role</th>
</tr>
<tr>
<td>limit</td>
<td>Numerical value</td>
<td>Number of tracks to receive</td>
</tr>
</tbody>
</table>
GetRecentTracks
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/DataService?Operation=GetRecentTracks</td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Request returns trajectory geometries of all moving units in user group.</td>
<td>URL encoded text/plain</td>
</tr>
</tbody>
</table>
Sensor Service
SensorService provides information about sensors and enables to get measured or processed data.
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/SensorService?Operation=<var>operationName</var></td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Provides detailed information about sensors and provides methods to get sensor data.</td>
<td>JSON</td>
</tr>
</tbody>
</table>
GetSensors
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/SensorService?Operation=GetSensors</td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Request returns list of sensors connected to entered unit.</td>
<td>JSON</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th>Parameter</th>
<th>Format</th>
<th>Role</th>
</tr>
<tr>
<td>unit_id</td>
<td>Numerical value</td>
<td>Identifier of unit (mandatory)</td>
</tr>
</tbody>
</table>
GetObservations
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/SensorService?Operation=GetObservations</td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Request provides access to measured or processed observations for entered unit-sensor pair and entered time range. If user doesn't enter time range, servlet returns all available observations for entered unit-sensor pair. Another optional parameter is trunc that executes average of values for entered epoch (hour, day, week,...).</td>
<td>JSON</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th>Parameter</th>
<th>Format</th>
<th>Role</th>
</tr>
<tr>
<td>unit_id</td>
<td>Numerical value</td>
<td>Identifier of unit (mandatory)</td>
</tr>
<tr>
<td>sensor_id</td>
<td>Numerical value</td>
<td>Identifier of sensor (mandatory)</td>
</tr>
<tr>
<td>from</td>
<td>Timestamp (ISO 8601)</td>
<td>Time stamp of beginning time range (optional)</td>
</tr>
<tr>
<td>to</td>
<td>Timestamp (ISO 8601)</td>
<td>Time stamp of end time range (optional)</td>
</tr>
<tr>
<td>trunc</td>
<td>Text</td>
<td>Average epoch (optional)</td>
</tr>
</tbody>
</table>
GetLastObservations
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/SensorService?Operation=GetLastObservations</td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Provides last observations of specified unit or group of units. Returns JSON with observations.</td>
<td>JSON</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th>Parameter</th>
<th>Format</th>
<th>Role</th>
</tr>
<tr>
<td>group</td>
<td>Textual value</td>
<td>Name of group of units (optional), alone or with sensor_id</td>
</tr>
<tr>
<td>unit_id</td>
<td>Numerical value</td>
<td>Identifier of unit (optional), alone or with sensor_id</td>
</tr>
<tr>
<td>sensor_id</td>
<td>Numerical value</td>
<td>Identifier of sensor (optional)</td>
</tr>
</tbody>
</table>
GetLastObservations - allowed combinations
- &group=
- &group=&sensor_id=
- &unit_id=
- &unit_id=&sensor_id=
AlertService
AlertService provides information about alerts events that arrived in sensor network. Methods allow user to get description of potential alerts connected to specific unit and list of arrived alert events including solving state.
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/AlertService?Operation=<var>operationName</var></td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Provides information about alerts events that arrived in sensor network.</td>
<td>JSON</td>
</tr>
</tbody>
</table>
GetAlerts
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/AlertService?Operation=GetAlerts</td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Request provides list of potential alerts for entered unit.</td>
<td>JSON</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th>Parameter</th>
<th>Format</th>
<th>Role</th>
</tr>
<tr>
<td>unit_id</td>
<td>Numerical value</td>
<td>Identifier of unit (mandatory)</td>
</tr>
</tbody>
</table>
GetAlertEventsByTime
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/AlertService?Operation=GetAlertEventsByTime</td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>GET</td>
<td>Request provides list of arrived alert events for specified unit and specified time range.</td>
<td>JSON</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th>Parameter</th>
<th>Format</th>
<th>Role</th>
</tr>
<tr>
<td>unit_id</td>
<td>Numerical value</td>
<td>Identifier of unit (mandatory)</td>
</tr>
<tr>
<td>from</td>
<td>Timestamp (ISO 8601)</td>
<td>Time stamp of beginning time range (optional)</td>
</tr>
<tr>
<td>to</td>
<td>Timestamp (ISO 8601)</td>
<td>Time stamp of end time range (optional)</td>
</tr>
</tbody>
</table>
ManagementService
ManagementService allows user to register unit with sensors. This service is especially suitable for scenario "collecting data by smartphones", it enables register new smartphone before starting of collecting data.
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/ManagementService?Operation=<var>operationName</var></td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>POST</td>
<td>Provides registration of new components of sensor network</td>
<td>JSON</td>
</tr>
</tbody>
</table>
InsertUnit
<table>
<tbody>
<tr>
<th colspan="3">URL</th>
</tr>
<tr>
<td colspan="3">/ManagementService?Operation=InsertUnit</td>
</tr>
<tr>
<th>Method</th>
<th>Functionality</th>
<th>Format</th>
</tr>
<tr>
<td>POST</td>
<td>Provides insertion of new unit with sensors into database. Returns JSON description of the unit with IDs of unit, sensors and phenomenons.</td>
<td>JSON</td>
</tr>
</tbody>
</table>
Example of InsertUnit payload
{
"unit":{
"description":"test insert unit"
},
"sensors":[
{
"sensor_name":"test sensor1",
"sensor_type":"testing sensor",
"phenomenon":{
"phenomenon_name":"testing phenomenon 1",
"uom":"rounds"
}
},
{
"sensor_name":"test sensor 2",
"sensor_type":"testing sensor",
"phenomenon":{
"phenomenon_name":"testing phenomenon 2",
"uom":"points"
}
}
]
}