Sends a request to the PurpleAir API endpoint described at: https://api.purpleair.com/#api-sensors-get-sensor-data
pa_getSensorData(
api_key = NULL,
sensor_index = NULL,
fields = SENSOR_DATA_PM25_FIELDS,
baseUrl = "https://api.purpleair.com/v1/sensors"
)
PurpleAir API READ key.
The sensor_index
as found in the JSON for this
specific sensor.
Optional parameter specifying sensor data fields to return.
URL endpoint for the "Get Member Data" API.
List containing all recent data for a single sensor.
# \donttest{
# Fail gracefully if any resources are not available
try({
library(AirSensor)
pa_getSensorData(
api_key = PURPLE_AIR_API_READ_KEY,
sensor_index = MY_SENSOR_INDEX,
fields = SENSOR_DATA_PM25_FIELDS
)
}, silent = FALSE)
#> Error in MazamaCoreUtils::stopIfNull(api_key) :
#> object 'PURPLE_AIR_API_READ_KEY' not found
# }