Update README.md with note about URL paths

This commit is contained in:
Bendodroid 2024-02-13 19:48:18 +01:00
parent 7218177625
commit b98174c7da
Signed by: bendodroid
GPG key ID: 3EEE19A0F73D5FFC

View file

@ -3,7 +3,7 @@
`spaceapid` serves a [SpaceAPI](https://spaceapi.io)-compatible JSON on port 8080:
```shell
$ curl -X GET http://[::1]:8080 | jq
$ curl http://[::1]:8080 | jq
{
"api_compatibility": [
"14"
@ -26,7 +26,7 @@ The config consists of three parts:
- `"response"`
- The static (pre-filled) parts of the response
See [Running](#running) for details.
See [Running](#Running) for details.
## Updating values
@ -37,12 +37,18 @@ curl -X PUT -u user:password -d true http://[::1]:8080/state/open
```
The same is true for the endpoints for sensors configured under `"dynamic"`.
Currently only `temperature` and `humidity` are implemented.
Currently only the sensors with the `value/unit/location/name/description` schema are implemented.
At the time of writing this includes `temperature`, `barometer`, `humidity`, `beverage_supply`, `power_consumption`,
and `account_balance`.
Out-of-spec sensors may also be used as long as they share the same schema.
```shell
curl -X PUT -u user:password -d 23.42 http://[::1]:8080/sensors/{temperature,humidity}/location[/name]
curl -X PUT -u user:password -d 23.42 http://[::1]:8080/sensors/{temperature,humidity,...}[/location[/name]]
```
As can be seen in the example, the http urls are generated from sensor type and optionally `location` and `name`.
Depending on sensor type `location` might be required for your sensors, see the schema for details.
## Building
See the `go.mod` file for minimum required Go version.