mirror of
https://github.com/ConnectedHumber/Air-Quality-Web
synced 2024-11-17 05:43:01 +00:00
Add link to production api.php in API docs, and change default action to a helpful message
Also bump version
This commit is contained in:
parent
d7301ac359
commit
233d780123
6 changed files with 54 additions and 4 deletions
|
@ -1,5 +1,8 @@
|
|||
# Changelog
|
||||
|
||||
# v0.9.1 - 16th May 2019
|
||||
- [API] Changed the default action. It now displays a helpful message by default instead of routing directly to `fetch-data`.
|
||||
|
||||
# v0.9 - 9th May 2019
|
||||
- Add heatmap gauge at the right-hand-side
|
||||
- Display the changelog the first time a user loads the page after an update
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# API
|
||||
The server-side API is accessed through `api.php`, and supports a number of GET parameters. The most important of these is the `action` parameter, Which determines what the API will do. The following values are supported:
|
||||
The server-side API is accessed through `api.php`, and supports a number of GET parameters. On the main production instance, this can be found [here](https://aq.connectedhumber.org/api.php).
|
||||
|
||||
The most important of these is the `action` parameter, Which determines what the API will do. The following values are supported:
|
||||
|
||||
## version
|
||||
> Returns the version of the application.
|
||||
|
|
45
logic/Actions/Index.php
Normal file
45
logic/Actions/Index.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace AirQuality\Actions;
|
||||
|
||||
use \SBRL\TomlConfig;
|
||||
|
||||
use \AirQuality\PerfFormatter;
|
||||
|
||||
class Changelog implements IAction {
|
||||
/** @var TomlConfig */
|
||||
private $settings;
|
||||
|
||||
/** @var \ParsedownExtra */
|
||||
private $parsedown_ext;
|
||||
|
||||
public function __construct(
|
||||
TomlConfig $in_settings) {
|
||||
$this->settings = $in_settings;
|
||||
}
|
||||
|
||||
public function handle() : bool {
|
||||
global $start_time;
|
||||
|
||||
$start_handle = microtime(true);
|
||||
|
||||
|
||||
// 1: Parse markdown
|
||||
$result = "Welcome to the Air Quality Web HTTP API!
|
||||
|
||||
Although the web interface is the default thing you see, it actually uses this HTTP API as a backend - which can be interacted with directly.
|
||||
|
||||
Official usage documentation for the latest version of the API can be found here: https://aq.connectedhumber.org/__nightdocs/05-API-Docs.html
|
||||
|
||||
Note that if you have deployed your own version of the air quality web interface, you will need to ensure you're up-to-date with the latest commits in the \"master\" branch, otherwise the HTTP API documentation may not be completely accurate with respect to the version you're running.
|
||||
";
|
||||
|
||||
|
||||
// 2: Send response
|
||||
header("content-length: " . strlen($result));
|
||||
header("content-type: text/plain");
|
||||
header("x-time-taken: " . PerfFormatter::format_perf_data($start_time, $start_handle, null));
|
||||
echo($result);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "air-quality-mapper",
|
||||
"version": "0.1.0",
|
||||
"version": "0.9.1",
|
||||
"description": "The web interface and JSON api for the ConnectedHumber Air Quality Monitoring Project.",
|
||||
"private": true,
|
||||
"main": "index.mjs",
|
||||
|
|
|
@ -26,7 +26,7 @@ password = "Define_in_custom_config_file"
|
|||
# Settings that control the router's behaviour
|
||||
|
||||
# The default action to take if no action is specified
|
||||
default-action = "fetch-data"
|
||||
default-action = "index"
|
||||
|
||||
[cache]
|
||||
# Settings that control how we request that appropriate API responses be cached.
|
||||
|
|
2
version
2
version
|
@ -1 +1 @@
|
|||
v0.9.1
|
||||
v0.9.2
|
||||
|
|
Loading…
Reference in a new issue