GET api/v1/devices/{deviceId}/charts/{chartId}/measurements/channel/{channel}?startDate={startDate}&endDate={endDate}&limit={limit}&aggregationThreshold={aggregationThreshold}&rangeType={rangeType}

Get the measurements for the device/channel in a chartable (aggregated) 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

chartId

Reserved for later use. Use Guid.Empty ("00000000-0000-0000-0000-000000000000") for now.

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 number of measurement points. 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. If startDate and endDate are set do not include limit.

integer

None.

aggregationThreshold

How many "buckets" the aggregation should optimise into. Typically this would be at max the x-pixels on the chart. Defaults to 500

integer

Default value is 500

rangeType

The range type of the chart (i.e. individual points or hourly, daily etc)

ChartDataRangeType

Default value is Points

Body Parameters

None.

Response Information

Resource Description

ChartDataDto
NameDescriptionTypeAdditional information
Fields

Collection of ChartFieldDataDto

None.

Response Formats

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

Sample:
{
  "Fields": [
    {
      "Name": "sample string 1",
      "FieldLabel": "sample string 2",
      "Unit": "sample string 3",
      "ChartColor": "sample string 4",
      "UseSecondAxis": true,
      "Points": [
        [
          1.0,
          2.0
        ],
        [
          1.0,
          2.0
        ]
      ],
      "Statistics": {
        "TotalPoints": 1,
        "Average": 2.0,
        "StandardDeviation": 3.0,
        "Min": 4.0,
        "Max": 5.0,
        "DateRange": {
          "Start": "2017-06-26T17:12:03.1577101+00:00",
          "End": "2017-06-26T17:12:03.1577101+00:00"
        },
        "Sum": 6.0
      }
    },
    {
      "Name": "sample string 1",
      "FieldLabel": "sample string 2",
      "Unit": "sample string 3",
      "ChartColor": "sample string 4",
      "UseSecondAxis": true,
      "Points": [
        [
          1.0,
          2.0
        ],
        [
          1.0,
          2.0
        ]
      ],
      "Statistics": {
        "TotalPoints": 1,
        "Average": 2.0,
        "StandardDeviation": 3.0,
        "Min": 4.0,
        "Max": 5.0,
        "DateRange": {
          "Start": "2017-06-26T17:12:03.1577101+00:00",
          "End": "2017-06-26T17:12:03.1577101+00:00"
        },
        "Sum": 6.0
      }
    }
  ]
}

application/xml, text/xml

Sample:
<ChartDataDto xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AnalysisUK.Tinamous.www.ApiControllers.Models.DeviceChartsMeasurements">
  <Fields>
    <ChartFieldDataDto>
      <ChartColor>sample string 4</ChartColor>
      <FieldLabel>sample string 2</FieldLabel>
      <Name>sample string 1</Name>
      <Points xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:ArrayOfdecimal>
          <d4p1:decimal>1</d4p1:decimal>
          <d4p1:decimal>2</d4p1:decimal>
        </d4p1:ArrayOfdecimal>
        <d4p1:ArrayOfdecimal>
          <d4p1:decimal>1</d4p1:decimal>
          <d4p1:decimal>2</d4p1:decimal>
        </d4p1:ArrayOfdecimal>
      </Points>
      <Statistics>
        <Average>2</Average>
        <DateRange>
          <End>2017-06-26T17:12:03.1577101+00:00</End>
          <Start>2017-06-26T17:12:03.1577101+00:00</Start>
        </DateRange>
        <Max>5</Max>
        <Min>4</Min>
        <StandardDeviation>3</StandardDeviation>
        <Sum>6</Sum>
        <TotalPoints>1</TotalPoints>
      </Statistics>
      <Unit>sample string 3</Unit>
      <UseSecondAxis>true</UseSecondAxis>
    </ChartFieldDataDto>
    <ChartFieldDataDto>
      <ChartColor>sample string 4</ChartColor>
      <FieldLabel>sample string 2</FieldLabel>
      <Name>sample string 1</Name>
      <Points xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:ArrayOfdecimal>
          <d4p1:decimal>1</d4p1:decimal>
          <d4p1:decimal>2</d4p1:decimal>
        </d4p1:ArrayOfdecimal>
        <d4p1:ArrayOfdecimal>
          <d4p1:decimal>1</d4p1:decimal>
          <d4p1:decimal>2</d4p1:decimal>
        </d4p1:ArrayOfdecimal>
      </Points>
      <Statistics>
        <Average>2</Average>
        <DateRange>
          <End>2017-06-26T17:12:03.1577101+00:00</End>
          <Start>2017-06-26T17:12:03.1577101+00:00</Start>
        </DateRange>
        <Max>5</Max>
        <Min>4</Min>
        <StandardDeviation>3</StandardDeviation>
        <Sum>6</Sum>
        <TotalPoints>1</TotalPoints>
      </Statistics>
      <Unit>sample string 3</Unit>
      <UseSecondAxis>true</UseSecondAxis>
    </ChartFieldDataDto>
  </Fields>
</ChartDataDto>