Type: | Package |
Title: | Client for the 'Cumulocity' API |
Version: | 0.1.0 |
Imports: | httr, jsonlite |
Suggests: | testthat, knitr, rmarkdown, covr |
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/. |
License: | GPL-3 |
URL: | https://softwareag.github.io/cumulocityr/, https://github.com/SoftwareAG/cumulocityr |
BugReports: | https://github.com/SoftwareAG/cumulocityr/issues |
Encoding: | UTF-8 |
LazyData: | true |
VignetteBuilder: | knitr |
RoxygenNote: | 6.1.1 |
NeedsCompilation: | no |
Packaged: | 2019-10-16 22:31:16 UTC; dmitriy |
Author: | Dmitriy Bolotov [aut, cre], Software AG [cph] |
Maintainer: | Dmitriy Bolotov <dmitriy.bolotov@softwareag.com> |
Repository: | CRAN |
Date/Publication: | 2019-10-20 12:10:02 UTC |
Client for the Cumulocity API
Description
Access the 'Cumulocity' API and retrieve data on devices, measurements, and events.
Functions
-
get_devices
returns available devices for a tenant. -
get_measurements
returns measurements for a device. -
get_events
returns events for a device.
Authentication
The package expects a local .Renviron file with credentials defined as follows:
CUMULOCITY_base_url = "[tenant url]" CUMULOCITY_usr = "[username]" CUMULOCITY_pwd = "[password]" CUMULOCITY_device_id = "[an example device id]"
The tenant url should be of the form "https://tenant_name.cumulocity.com"
.
CUMULOCITY_device_id
is not required by any of the main functions.
.Renviron
can be edited with usethis::edit_r_environ()
.
Other considerations
Time should be in the following format: "YYYY-MM-DDTHH:MM:SSZ"
References
Author(s)
Maintainer: Dmitriy Bolotov dmitriy.bolotov@softwareag.com
Other contributors:
Software AG [copyright holder]
See Also
Useful links:
Report bugs at https://github.com/SoftwareAG/cumulocityr/issues
Get the devices or for a tenant.
Description
Get the devices or for a tenant.
Usage
get_devices(num_rows = NULL, parse_json = TRUE)
Arguments
num_rows |
The number of records to return. |
parse_json |
If TRUE, parse the JSON object into a data frame. |
Details
Get the devices for a tenant.
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.
Value
A data.frame
if parse_json = TRUE
,
and a character string otherwise.
Author(s)
Dmitriy Bolotov
References
Examples
get_devices()
Get the events for a device.
Description
Get the events for a device.
Usage
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. |
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.
Get the events 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
Examples
get_events(device_id, date_from = "2019-09-30T20:00:00Z")
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
Examples
get_measurements(device_id, date_from = "2019-09-30T20:00:00Z")