Read Time Series Data for a Property of a Thing Applying M4 Algorithm

Retrieves time series data for a specified property

With this service, you can read the time series data for a specific property of a thing by applying the M4 algorithm. This algorithm is used to aggregate the time series data for n number of divisions. Divisions correspond to the number of intervals into which the given time range needs to be divided. For each interval, the service returns unique minimum value, maximum value, first occurring value, and last occurring value, if they exist. Hence, there would be a maximum of four values per division returned. This service only supports property set types of data categories TimeSeriesData and DerivedData.

Request

URI: /Things('<ID>')/<thing type name>/<property set ID>?timerange=<fromTime>-<toTime>&$apply=sap.lineChart(divisions=<number of divisions>, property='<propertyID>')

HTTP Method: GET

Permissions: <thing>.r

Request Headers

Parameter Required Description
Accept-Encoding No Retrieve compressed response

Only if you specify the value gzip or gzip,deflate for this parameter, the system returns the compressed response with an additional response header CONTENT-ENCODING with value gzip. If you specify an invalid value or do not use this header parameter, the system returns the uncompressed response.

Request Parameters

Parameter Required Data Type Description
ID Yes string

You can specify one of the following values:

  • Unique thing identifier generated by the system while creating a thing.

  • Alternate thing identifier which is unique only within a specific tenant.

thingTypeName Yes String Name of the thing type.
propertySetID Yes String Unique identifier of the property (that belongs to the property set type) defined in a thing type.
timerange Yes Timestamp You can provide a from time and to time for which the aggregates are calculated for a property. Alternatively, you can provide the duration of time in days, months, or years for calculating the aggregate.
division Yes Numeric Number of intervals into which the given time range needs to be divided.
property Yes String Name of the property.

Request Example

/Things('503B8711B5D0445688E7FF7ACFC2177A')/core.automobiles:ABCXSeries/wheel_fl?timerange=2015-08-01T06:00:00Z-2015-08-02T09:00:00Z&$apply=sap.lineChart(divisions=400,property='Speed')

Retrieves property set data of the property set wheel_fl for the thing ID 503B8711B5D0445688E7FF7ACFC2177A corresponding to a time range between 2015-08-01T06:00:00Z and 2015-08-02T09:00:00Z.

/Things('503B8711B5D0445688E7FF7ACFC2177A')/core.automobiles:ABCXSeries/wheel_fl?timerange=2D&$apply=sap.lineChart(divisions=400,property='Speed')

Retrieves property set data of the property set wheel_fl for the thing ID 503B8711B5D0445688E7FF7ACFC2177A corresponding to a time duration of 2 days.

Response

Format: JSON

Response Status and Error Codes

Code Description
200 Data retrieved successfully

Payload

Format: JSON

Only media type JSON is supported. The JSON for this method has the following structure:

{
	"value": [{
		"_time": "2015-08-01T09:00:00.000Z",
		"WheelBase": "11"
	}, {
		"_time": "2015-08-02T06:00:03.000Z",
		"WheelBase": "10"
	}]
}