Menu

RetrieveBySensor

Jim

Retrieve Data by Sensor

Returns stored device data for one sensor of a device

Path: cs-ws/resources/retrieval/sensor Method: GET

Parameters

  • apikey
  • device_name
  • sensor_name
  • from ... timestamp as yyyy-mm-dd hh:hh:ss.SSS
  • to ... timestamp as yyyy-mm-dd hh:hh:ss.SSS
  • direction ...=asc|desc: controls whether timestamped data are retrieved in ascending or descending order, ascending is default
  • count ...=true: retrieves only the number of retrieved moments, not the moments themselves
  • limit ...=nnn: only up to nnn moments are retrieved. If a limit is reached for a moment series the response contains an element <next_timestamp> which can be used in a continuation of the retrieval for this time series</next_timestamp>
  • rollupLength: the length of the rollup interval in minutes, default is 0 meaning no rollup performed
  • rollupOp: the operation to performed, one of AVG | SUM | MIN | MAX, default is AVG

Errors:

  • 401 UNAUTHORIZED if key is invalid
  • 404 NOT FOUND if the device or sensor is not found

Example

GET http://localhost/cs-ws/resources/retrieval/sensor?direction=asc&count=false&
to=2012-09-01%2001%3A00%3A00.000&from=2012-08-31%2001%3A00%3A00.000
&device_name=TempDev2&limit=-1&apikey=1234&sensor_name=TemperatureSensor HTTP/1.1

HTTP/1.1 200 OK
<sensor>
   <attribute>
      <moment>
         <timestamp>2012-08-31 19:55:54.036</timestamp>
         <value>1.1</value>
      </moment>
      <moment>
         <timestamp>2012-08-31 19:58:54.036</timestamp>
         <value>1.1</value>
      </moment>
      <name>Temperature</name>
      <result>
         <count>2</count>
         <limit_reached>false</limit_reached>
         <next_timestamp/>
      </result>
   </attribute>
   <name>TemperatureSensor</name>
</sensor>

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.