get_measurements {cumulocityr}R Documentation

Get the measurements for a device.

Description

Get the measurements for a device.

Usage

get_measurements(device_id, date_from, date_to = NULL, num_rows = NULL,
  parse_json = TRUE)

Arguments

device_id

The device id.

date_from

The starting datetime.

date_to

The ending datetime.

num_rows

The number of records to return.

parse_json

If TRUE, parse the JSON object into a data frame.

Details

The datetime fields date_from and date_from are expected to be strings in the format "YYYY-MM-DDTHH:MM:SSZ".

If date_to is null, it is set to the current time.

If num_rows and both dates are specified, the lesser of the two ranges is returned.

If parse_json is TRUE, the JSON object is parsed using jsonlite::fromJSON before being returned. The data is converted to a single flattened data frame. If a page does not contain any measurements, it does not get added to the data frame.

If parse_json is FALSE, the JSON object is returned as a JSON string. For queries with multiple pages, a list of such objects is returned. Each element in this list contains up to 2000 records.

Get the measurements for a device for a time period.

Value

A data.frame if parse_json = TRUE, and a character string otherwise.

Author(s)

Dmitriy Bolotov

References

Cumulocity Measurements API

Examples


get_measurements(device_id, date_from = "2019-09-30T20:00:00Z")


[Package cumulocityr version 0.1.0 Index]