Sections
Method: POST
Configures properties of a specific device (logger). Accepts a set of known configuration parameters; unknown parameters are ignored and reported in the response.
Base URL
https://dlb.com.pl/api/v1/logger_config.php
Query parameters
| Key | Type | Description | |
|---|---|---|---|
| user | Required | string | Login |
| mac | Required | string | Device MAC address |
| devkey | Required | string | Device authentication key |
| token | string | Authentication token (see Authentication) | |
| analog_treshold | string | Analog input threshold value | |
| analog_sleep_time | string | Analog input polling interval | |
| new_devkey | string | New device key to set. Current devkey must be provided for authorization. The new key becomes valid for all subsequent requests. |
|
Note: The list of accepted configuration parameters is not fixed and may be extended. Any unknown parameters sent in the request are accepted but silently ignored; their names are reported in the response warning field.
Authentication
This endpoint requires two independent forms of authentication:
-
API token — required; you can provide it using one of the following methods:
- POST parameter:
token - Standard Bearer token in the header:
Authorization: Bearer {token} - API key in the header:
HTTP_X_API_KEY: {token}
- POST parameter:
-
Device key (
devkey) — a per-device key required to authorize configuration changes.
Response
On success, returns a JSON object:
| Key | Type | Description |
|---|---|---|
| status | string | Always "OK" on success |
| mac | string | MAC address of the configured device |
| warning | string | Present only if unknown POST parameters were passed; lists the ignored parameter names |
Example response (no unknown params):
{"status": "OK", "mac": "00:00:95:9D:68:16"}
Example response (with unknown params):
{"status": "OK", "mac": "00:00:95:9D:68:16", "warning": "Unknown parameters: foo, bar. They were ignored."}
Error Responses
| HTTP Code | Message | Cause |
|---|---|---|
| 400 | 400 Bad Request. Missing parameters |
user or mac is missing |
| 400 | 400 Bad Request: Unknown mac |
Device with given MAC not found for this user |
| 400 | 400 Bad Request: <message> |
Invalid parameter value (ValueError from set operation) |
| 403 | 403 Unauthorized access |
Invalid API token or invalid devkey |
| 405 | 405 Method Not Allowed |
Request method is not POST |
| 500 | 500 Internal Server Error |
Unexpected server error |