External API Endpoints
The external API can be used to control the garage door by other systems or software.
If authentication is enabled, you need to provide a Authorization header with a token. More details are below.
Successful calls will return status code 200 or 201. Other status codes that can return are:
- 400 - Bad Request
- This indicates, that the requested endpoint is not found.
- 401 - Unauthorized
- This indicates, that either the
Authorizationheader or theX-Access-Sourceheader is missing or wrong. Currently theX-Access-Sourceis only required for the control endpoint.
- This indicates, that either the
- 403 - Forbidden
- This indicates, that the requested endpoint is not reachable.
Obtaining Auth Token
post/api/auth🔓
Send a POST request to the endpoint with Content-Type: application/x-www-form-urlencoded and include pwd=<your password> in the request body.
The response will return an authentication token — add it as the Authorization header on all subsequent protected requests.
{
"token": "68asc...s18"
}
Unprotected Endpoints
get/api/info🔓
Returns informations about the board if the API is up and running.
{
"mac": "08:A6:F7:A8:6B:14",
"ip": "192.168.1.92",
"hostname": "PandaGarage-6B",
"rssi": -54,
"version_fw": "0.1.57",
"version_fs": "0.1.20",
"version_hw": "1.0",
"sn": "pg_52gjw_0000",
"uptime": 418069
}
get/api/status🔓
Call this endpoint to get the current status of the garage door and it's sensors.
Response will be:
{
"status": "ok",
"version_fw": "0.1.55",
"door": {
"position_current": 0,
"position_target": 0,
"state": "closed",
"moving": false,
"light": false
},
"sensor": {
"temperature": 33.35571,
"humidity": 35.55908,
"lux": 237,
"externalSensor": "none"
}
}
post/api/restart🔓
Call this endpoint to restart your PandaGarage.
Response will be:
{
"status": "restarting"
}
Protected Endpoints
post/api/control🔒
The control endpoint is used to control the actual garage door. If the request was successful, the response will be a simple JSON message:
{
"status": "ok"
}
You need to provide an action parameter, containing one of the following values:
opento open the garage doorcloseto close the garage doorstopto stop the garage door movementventto move the garage door into vent positionhalfto move the garage door into half positionpositionmove the garage door to a specific position.- An additional
positionparameter is required. the value can be between0and100
- An additional
lightto control the built in light.- An additional optional
stateparameter can be set with the valuesonoroff. - if no additional parameter is provided, the light will simply be toggled
- An additional optional
Additionally to the Authorization header, the control endpoint requires a X-Access-Source header. This header must be set to api, otherwise you will receive a 401 error.
When the request has a wrong parameter or is missing a parameter the response will be:
{
"status": "invalid"
}
post/api/buzzer/play🔒
Call this endpoint to play a provided tune from the buzzer.
You need to provde a tune parameter, with the value of the tune you want to play. Currently 1-4.
Response will be:
{
"status": "ok"
}