Current API version: v1
The API is available at http(s)://<yourip/domain>/api/<VERSION>.
To get private data, you must pass an API token with the request. You can create an API token from your user profile page.
To pass your token, add it to the beginning or anywhere in your API query:
NOTE: Passing your token in a query string can be insecure and result in it being stored in your browser history.
?token=<API_TOKEN>- No Query:
http(s)://<yourip/domain>/api/v1/json/dashboard?token=<API_TOKEN> - Query:
http(s)://<yourip/domain>/api/v1/json/tower?token=<API_TOKEN>&id={TOWER_ID}
- No Query:
- HTML:
http(s)://<yourip/domain>/api/v1/html/dashboard - JSON:
http(s)://<yourip/domain>/api/v1/json/dashboard
- HTML:
http(s)://<yourip/domain>/api/v1/html/dashboard?main - JSON:
http(s)://<yourip/domain>/api/v1/json/dashboard?main
- HTML:
http(s)://<yourip/domain>/api/v1/html/tower - JSON:
http(s)://<yourip/domain>/api/v1/json/tower
- HTML:
http(s)://<yourip/domain>/api/v1/html/tower?id={TOWER_ID} - JSON:
http(s)://<yourip/domain>/api/v1/json/tower?id={TOWER_ID}
- HTML:
http(s)://<yourip/domain>/api/v1/html/archive - JSON:
http(s)://<yourip/domain>/api/v1/json/archive
- JSON:
http(s)://<yourip/domain>/api/v1/json/archive/search?query=&start=&end=&sort=&limit=- Set
queryto one ofwind/rain/temp/relh/pressure/lightning/uv/light. - Set
startand optionallyendto the Start/End Date and Time. Setting just the date will use 00:00:00 for time. Ifendis not specified, defaults tonow. - Optionally, set
sorttoascordesc. Sort defaults toasc. - Optionally, set
limitto limit the number of results returned. Defaults to 100 without a token/admin login!
- Set
- Camera Watermark:
http(s)://<yourip/domain>/api/v1/text/watermark - Cumulus formatted Realtime:
http(s)://<yourip/domain>/api/v1/text/realtime
- Date/Time:
http(s)://<yourip/domain>/api/system/time - Health:
http(s)://<yourip/domain>/api/system/health
- Config Data:
http(s)://<yourip/domain>/api/system/config - PHP Info:
http(s)://<yourip/domain>/api/system/phpinfo - Sensor Status:
http(s)://<yourip/domain>/api/system/status
function getWeatherData($acuparseURL)
{
$w = file_get_contents($acuparseURL . '/api/v1/json/dashboard?main');
$w = json_decode($w);
return $w->main;
}
$weather = getWeatherData('http(s)://<yourip/domain>');
// Main Readings
$tempF = $weather->main->tempF;
$tempC = $weather->main->tempC;
$tempF_trend = $weather->main->tempF_trend;
$feelsF = $weather->main->feelsF;
$feelsC = $weather->main->feelsC;
$dewptF = $weather->main->dewptF;
$dewptC = $weather->main->dewptC;
$tempC_high = $weather->main->tempC_high;
$tempF_high = $weather->main->tempF_high;
$high_temp_recorded = $weather->main->high_temp_recorded;
$tempC_low = $weather->main->tempC_low;
$tempF_low = $weather->main->tempF_low;
$low_temp_recorded = $weather->main->low_temp_recorded;
$tempC_avg = $weather->main->tempC_avg;
$tempF_avg = $weather->main->tempF_avg;
$relH = $weather->main->relH;
$relH_trend = $weather->main->relH_trend;
$windSpeedMPH = $weather->main->windSpeedMPH;
$windSpeedKMH = $weather->main->windSpeedKMH;
$windDEG = $weather->main->windDEG;
$windDIR = $weather->main->windDIR;
$windDEG_peak = $weather->main->windDEG_peak;
$windDIR_peak = $weather->main->windDIR_peak;
$windSpeedMPH_peak = $weather->main->windSpeedMPH_peak;
$windSpeedKMH_peak = $weather->main->windSpeedKMH_peak;
$windSpeed_peak_recorded = $weather->main->windSpeed_peak_recorded;
$windBeaufort = $weather->main->windBeaufort;
$windGustDEG = $weather->main->windGustDEG;
$windGustDIR = $weather->main->windGustDIR;
$windGustMPH = $weather->main->windGustMPH;
$windGustKMH = $weather->main->windGustKMH;
$windGustPeakMPH = $weather->main->windGustPeakMPH;
$windGustPeakKMH = $weather->main->windGustPeakKMH;
$windGustDEGPeak = $weather->main->windGustDEGPeak;
$windGustDIRPeak = $weather->main->windGustDIRPeak;
$windGustPeakRecorded = $weather->main->windGustPeakRecorded;
$windAvgMPH = $weather->main->windAvgMPH;
$windAvgKMH = $weather->main->windAvgKMH;
$rainIN = $weather->main->rainIN;
$rainMM = $weather->main->rainMM;
$rainTotalIN_today = $weather->main->rainTotalIN_today;
$rainTotalMM_today = $weather->main->rainTotalMM_today;
$pressure_inHg = $weather->main->pressure_inHg;
$pressure_kPa = $weather->main->pressure_kPa;
$pressure_trend = $weather->main->pressure_trend;
$sunrise = $weather->main->sunrise;
$sunset = $weather->main->sunset;
$moonrise = $weather->main->moonrise;
$moonset = $weather->main->moonset;
$moon_age = $weather->main->moon_age;
$moon_stage = $weather->main->moon_stage;
$moon_illumination = $weather->main->moon_illumination;
$moon_nextNew = $weather->main->moon_nextNew;
$moon_nextFull = $weather->main->moon_nextFull;
$moon_lastNew = $weather->main->moon_lastNew;
$moon_lastFull = $weather->main->moon_lastFull;
$lastUpdated = $weather->main->lastUpdated;
// Atlas Readings
$lightIntensity = $weather->atlas->lightIntensity;
$lightIntensity_text = $weather->atlas->lightIntensity_text;
$lightSeconds = $weather->atlas->lightSeconds;
$lightHours = $weather->atlas->lightHours;
$uvIndex = $weather->atlas->uvIndex;
$uvIndex_text = $weather->atlas->uvIndex_text;
$battery = $weather->atlas->battery;
$signal = $weather->atlas->signal;
$lastUpdate = $weather->atlas->lastUpdate;
// Lightning
$strikecount = $weather->lightning->strikecount;
$dailystrikes = $weather->lightning->dailystrikes;
$currentstrikes = $weather->lightning->currentstrikes;
$interference = $weather->lightning->interference;
$interference_text = $weather->lightning->interference_text;
$last_strike_ts = $weather->lightning->last_strike_ts;
$last_strike_distance_KM = $weather->lightning->last_strike_distance_KM;
$last_strike_distance_M = $weather->lightning->last_strike_distance_M;
$last_update = $weather->lightning->last_update;Note: The following values will be null if you are not using an Access.
$windGustDEG, $windGustDIR, $windGustMPH, $windGustKMH, $windGustPeakMPH, $windGustPeakKMH
, $windGustDEGPeak, $windGustDIRPeak.
function getTowerSensorData($acuparseURL, $acuparseToken)
{
$t = file_get_contents($acuparseURL . '/api/v1/json/tower?token=' . $acuparseToken);
$t = json_decode($t);
return $t->towers;
}
$towers = getTowerSensorData('http(s)://<yourip/domain>', '<API_Token>');
foreach ($towers as $tower) {
$name = $tower->name;
$tempF = $tower->tempF;
$tempF_high = $tower->tempF_high;
$tempF_low = $tower->tempF_low;
$tempF_trend = $tower->tempF_trend;
$tempC = $tower->tempC;
$tempC_high = $tower->tempC_high;
$tempC_low = $tower->tempC_low;
$high_temp_recorded = $tower->high_temp_recorded;
$low_temp_recorded = $tower->low_temp_recorded;
$relH = $tower->relH;
$relH_trend = $tower->relH_trend;
$battery = $tower->battery;
$signal = $tower->signal;
$lastUpdated = $tower->lastUpdated;
}