Get the events for a device.

get_events(
  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.

Value

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

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 events, 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.

References

Cumulocity Events API

Examples

if (FALSE) { get_events(device_id, date_from = "2019-09-30T20:00:00Z") }