Title: | Client for the 'Cumulocity' API |
---|---|
Description: | Access the 'Cumulocity' API and retrieve data on devices, measurements, and events. Documentation for the API can be found at <https://www.cumulocity.com/guides/reference/rest-implementation/>. |
Authors: | Dmitriy Bolotov [aut, cre], Software AG [cph] |
Maintainer: | Dmitriy Bolotov <[email protected]> |
License: | GPL-3 |
Version: | 0.1.0.9000 |
Built: | 2024-11-04 04:49:28 UTC |
Source: | https://github.com/cumulocity-iot/cumulocityr |
Get the devices or for a tenant.
get_devices(num_rows = NULL, parse_json = TRUE)
get_devices(num_rows = NULL, parse_json = TRUE)
num_rows |
The number of records to return. |
parse_json |
If TRUE, parse the JSON object into a data frame. |
If num_rows = NULL
(default), all devices are 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 parse_json
is FALSE, the JSON object is returned as a JSON string.
A data.frame
if parse_json = TRUE
,
and a character string otherwise.
Dmitriy Bolotov
## Not run: get_devices() ## End(Not run)
## Not run: get_devices() ## End(Not run)
Get the events for a device.
get_events( device_id, date_from, date_to = NULL, num_rows = NULL, parse_json = TRUE )
get_events( device_id, date_from, date_to = NULL, num_rows = NULL, parse_json = TRUE )
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. |
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.
A data.frame
if parse_json = TRUE
,
and a character string otherwise.
Dmitriy Bolotov
## Not run: get_events(device_id, date_from = "2019-09-30T20:00:00Z") ## End(Not run)
## Not run: get_events(device_id, date_from = "2019-09-30T20:00:00Z") ## End(Not run)
Get the measurements for a device.
get_measurements( device_id, date_from, date_to = NULL, num_rows = NULL, parse_json = TRUE )
get_measurements( device_id, date_from, date_to = NULL, num_rows = NULL, parse_json = TRUE )
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. |
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.
A data.frame
if parse_json = TRUE
,
and a character string otherwise.
Dmitriy Bolotov
## Not run: get_measurements(device_id, date_from = "2019-09-30T20:00:00Z") ## End(Not run)
## Not run: get_measurements(device_id, date_from = "2019-09-30T20:00:00Z") ## End(Not run)