R/get_measurements_2.R
get_measurements_2.Rd
Get the measurements for a device for a time period.
get_measurements_2(device_id, date_from = NULL, date_to = NULL, page_size = 2000, pages_per_query = 1, start_page = 1, abridged = TRUE, parse_datetime = TRUE, parse = TRUE)
device_id | The device id. |
---|---|
date_from | The starting datetime. |
date_to | The ending datetime. |
page_size | The page size, set to 2000 (maximum) by default. |
pages_per_query | The number of pages to return per function call. |
start_page | The first page used in the query. |
abridged | If TRUE, exclude "self" and "source" fields from the result. |
parse_datetime | If TRUE, parse "time" field from char to POSIXlt. |
parse | If TRUE, parse the JSON object into a data frame. |
A data.frame
with measurements.
Note that some columns in the returned data frame contain data frames themselves.
For example, c8y_Mobile
is a data.frame
of 11 variables.
If both date_from
and date_to
are present, page_size
is not used.
If page_size
and both dates are NULL, the function will return up to 5 rows of data.
If parse
is TRUE, the JSON object is parsed using jsonlite::fromJSON
before being returned. The data is converted to a single flattened data frame, and datetimes
are converted to POSIXlt. If the measurement list is empty, it does not get added to the data frame.
If parse
is FALSE, the JSON object is returned raw. For queries with multiple pages, a
list of such objects is returned. All pages are added to the list, even if there are no measurements.
The params abridged
and parse_datetime
have no effect.
Get the measurements for a device for a time period.
The parameter page_size
is only used if date_from
or date_to
are NULL, or both are NULL.