View source: R/PurpleAir_API.R
PurpleAir_getSensorData | R Documentation |
Sends a request to the PurpleAir API endpoint described at: https://api.purpleair.com/#api-sensors-get-sensor-data
PurpleAir_getSensorData(
api_key = NULL,
sensor_index = NULL,
fields = PurpleAir_PAList_PM25_FIELDS,
baseUrl = "https://api.purpleair.com/v1/sensors"
)
api_key |
PurpleAir API READ key. |
sensor_index |
The |
fields |
Optional parameter specifying sensor data fields to return. |
baseUrl |
URL endpoint for the "Get Member Data" API. |
List containing all recent data for a single sensor.
# Fail gracefully if any resources are not available
try({
library(AirSensor2)
PurpleAir_getSensorData(
api_key = PurpleAir_API_READ_KEY,
sensor_index = MY_SENSOR_INDEX,
fields = PurpleAir_PAList_PM25_FIELDS
)
}, silent = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.