Menu

RetrieveByAttribute

Jim

Retrieve Data by Attribute

Returns stored device data for one attribute of a sensor of a device

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

Parameters

  • apikey
  • device_name
  • sensor_name
  • attribute_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 or attribute is not found

Example

GET http://localhost/cs-ws/resources/retrieval/attribute?direction=asc&count=false&
to=2012-08-31%2023%3A59%3A59.000&from=2012-08-31%2017%3A55%3A54.036&
device_name=TempDev2&limit=-1&apikey=1234&attribute_name=Temperature&
sensor_name=TemperatureSensor HTTP/1.1

HTTP/1.1 200 OK
<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>

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.