R/PurpleAir_API.R
PurpleAir_getSensorsData.Rd
Sends a request to the PurpleAir API endpoint described at: https://api.purpleair.com/#api-sensors-get-sensors-data
If show_only
is used to request specific sensors, the bounding box
information is ignored.
PurpleAir_getSensorsData(
api_key = NULL,
fields = PurpleAir_PAS_MINIMAL_FIELDS,
location_type = NULL,
read_keys = NULL,
show_only = NULL,
modified_since = NULL,
max_age = 0,
nwlng = NULL,
nwlat = NULL,
selng = NULL,
selat = NULL,
baseUrl = "https://api.purpleair.com/v1/sensors"
)
PurpleAir API READ key.
Optional parameter specifying sensor data fields to return.
The location_type
of the sensors. Possible values
are: 0 = Outside, 1 = Inside or NULL
= both.
Optional comma separated list of sensor read_keys is required for private devices. It is separate to the api_key and each sensor has its own read_key. Submit multiple keys by separating them with a comma (,) character for example: key-one,key-two,key-three.
Optional comma separated list of sensor_index values. When provided, the results are limited only to the sensors included in this list.
The modified_since parameter causes only sensors modified after the provided time stamp to be included in the results. Using the time_stamp value from a previous call (recommended) will limit results to those with new values since the last request. Using a value of 0 will match sensors modified at any time.
Filter results to only include sensors modified or updated
within the last max_age
seconds. Using a value of 0 will match sensors of any age.
A north west longitude for the bounding box.
A north west latitude for the bounding box.
A south east longitude for the bounding box.
A south east latitude for the bounding box.
URL endpoint for the "Get Member Data" API.
List containing latest data for multiple sensors.
# \donttest{
# Fail gracefully if any resources are not available
try({
library(AirSensor2)
PurpleAir_getSensorsData(
api_key = PurpleAir_API_READ_KEY,
fields = PurpleAir_PAS_MINIMAL_FIELDS
)
}, silent = FALSE)
#> Error in MazamaCoreUtils::stopIfNull(api_key) :
#> object 'PurpleAir_API_READ_KEY' not found
# }