GET api/v1/devices/{deviceId}/measurements/channel/{channel}?startDate={startDate}&endDate={endDate}&limit={limit}&sortOrder={sortOrder}&aggregation={aggregation}

Get the measurements for the device/channel. Returns measurements in SenML format. this method returns [limit] points from the [endDate] upto the [startDate]. If Ascending sort order is requested these points are listed in earliest measurement date first ranging to maximum measurement date, however if the [limit] number of points has been met then the earliest measurement date may not have reached the start date. The caller is required to make further calls with the [endDate] set to the minimum measurement date received in the previous page. If their are more than [limit] points the data set is limited that number of points working backwards from the end date.

Request Information

URI Parameters

NameDescriptionTypeAdditional information
deviceId

Id of the device

globally unique identifier

Required

channel

Measurement channel.

integer

Default value is 0

startDate

The earliest date to get measurements for.

string

Default value is

endDate

Leave null for measurements update current date/time

string

Default value is

limit

The maximum number of measurement points to return. Note that because a measurement point consists of many fields the actual returned [e] collection is likely to be number of Fields x measurement points. Defaults to 1000 is not set

integer

Default value is 1000

sortOrder

The order to return the data in. Sorting is done on the Measurement Date.

SortOrder

Default value is Asc

aggregation

Not supported yet. Options: None, Auto, Hourly, Daily, Weekly. Auto aggregates if large number of results.

MeasurementsAggregation

Default value is None

Body Parameters

None.

Response Information

Resource Description

SenMlMeasurementListDto
NameDescriptionTypeAdditional information
e

Collection of SenMlMeasurementDto

None.

bt

Base time offset for fields

integer

None.

bn

Base name for field names

string

None.

bu

Base unit

string

None.

ver

Version

integer

None.

Response Formats

application/json, text/json, application/senml+json

Sample:
{
  "e": [
    {
      "n": "sample string 1",
      "u": "sample string 2",
      "v": 1.0,
      "sv": "sample string 3",
      "bv": true,
      "s": 1.0,
      "t": 4.1,
      "ut": 1
    },
    {
      "n": "sample string 1",
      "u": "sample string 2",
      "v": 1.0,
      "sv": "sample string 3",
      "bv": true,
      "s": 1.0,
      "t": 4.1,
      "ut": 1
    }
  ],
  "bt": 1,
  "bn": "sample string 2",
  "bu": "sample string 3",
  "ver": 4
}

application/xml, text/xml

Sample:
<SenMlMeasurementListDto xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AnalysisUK.Tinamous.www.ApiControllers.Models.Measurements">
  <bn>sample string 2</bn>
  <bt>1</bt>
  <bu>sample string 3</bu>
  <e>
    <SenMlMeasurementDto>
      <bv>true</bv>
      <n>sample string 1</n>
      <s>1</s>
      <sv>sample string 3</sv>
      <t>4.1</t>
      <u>sample string 2</u>
      <ut>1</ut>
      <v>1</v>
    </SenMlMeasurementDto>
    <SenMlMeasurementDto>
      <bv>true</bv>
      <n>sample string 1</n>
      <s>1</s>
      <sv>sample string 3</sv>
      <t>4.1</t>
      <u>sample string 2</u>
      <ut>1</ut>
      <v>1</v>
    </SenMlMeasurementDto>
  </e>
  <ver>4</ver>
</SenMlMeasurementListDto>