Перейти до вмісту

API

Цей контент ще не доступний вашою мовою.

This HTTP API provides an interface for interacting with the Overvis MC261 device.

Web Interface API calls example

All requests are made to paths starting with /api (except for memory card files download, which start from /card). The API supports GET and POST methods, some of which require authorization.

  • All data is transferred in JSON format.
  • Successful responses use the 200 OK status.
  • Errors are handled with appropriate HTTP statuses (400 Bad Request, 404 Not Found, 503 Service Unavailable, etc.).
  • API request errors additionally contain a JSON object: { "error": "error code", "message": "error text" }.
  • HTTP keep-alive is supported.
  • Access to the API uses 3 access levels:
    • 🟩 0 - Guest
    • 🟨 1 - Power User
    • 🟥 2 - Administrator

To perform protected requests, you must complete the authorization procedure:

  1. Get a salt at /api/login/salt/.
  2. Log in via /api/login/ by sending a SHA1 password hash: login + password + salt (with admin for login).
  3. All subsequent requests must include the session token Bearer xxxxxxxxxx in the Authorization header.

Logout is performed via /api/cmd/logout/. After successful authorization, the user receives access level 🟨 1 (Power User).

Press the button on the front panel of the MC261 device once. After this, a user with Guest rights temporarily receives access level 🟨 1 (Power User) for 10 minutes.

All requests coming from the VPN cloud automatically receive access level 🟥 2 — Administrator.

PathPurposeAccess Level
/api/authorization/get/Get authorization and access data🟩 0
/api/login/salt/Get salt for password hashing🟩 0
/api/version/Device firmware version🟩 0
/api/identify/Physical device identification🟨 1
/api/list/wifi-aps/List of available Wi-Fi access points🟨 1
/api/lorasens/journal/read/?after=...LoraSens devices journal read🟨 1
/api/lth/sources/Get LTH temperature sensors state🟨 1
/api/lwg/sources/Get LWG weight sensors state🟨 1
/api/modbus/resp/?tid=...Get Modbus response by tid🟨 1
/api/modbus/find/result/?listGet Modbus device search result🟨 1
/api/modbus/class-find/result/Get Modbus template search result🟨 1
/api/settings/active/get/?key&...Get active settings by key🟨 1
/api/settings/saved/get/?key&...Get saved settings by key🟨 1
/api/state/get/?key&...Get current device state by key🟨 1
/card/<path-to-file>Download file from SD card🟨 1
PathPurposeAccess Level
/api/login/User authentication🟩 0
/api/card/dir/Get list of files and directories🟨 1
/api/card/file/info/Get file info on SD card🟨 1
/api/card/file/read/Read file from SD card🟨 1
/api/card/file/write/Write file to SD card🟨 1
/api/card/remove/Remove file from SD card🟨 1
/api/cmd/callback/reconnect/Reconnect to cloud server via Modbus🟨 1
/api/cmd/logout/End session🟨 1
/api/cmd/memory/card_eject/Safe SD card ejection🟨 1
/api/cmd/reboot/Reboot device🟨 1
/api/cmd/settings/reset/Reset settings to factory defaults🟨 1
/api/cmd/settings/import/Import configuration🟨 1
/api/cmd/settings/export/Export current settings🟨 1
/api/cmd/tasks/reread/Clear tasks and reread them from the card🟨 1
/api/cmd/time/sync/Time synchronization🟨 1
/api/cmd/time/set/Set time🟨 1
/api/cmd/updates/check/Check for updates available on the server🟨 1
/api/cmd/updates/download/Download available updates🟨 1
/api/cmd/updates/program/Apply update🟨 1
/api/lorasens/offer/bind/Bind the LoraSens device🟨 1
/api/lorasens/offer/ignore/Ignore the LoraSens device offering to bind🟨 1
/api/lorasens/device/configure/Configure the bound LoraSens device🟨 1
/api/lorasens/device/settings/read/Read the bound LoraSens device registers🟨 1
/api/lorasens/device/settings/write/Write the bound LoraSens device registers🟨 1
/api/lorasens/device/remove/Unbind the LoraSens device🟨 1
/api/lorasens/journal/clear/Clear the LoraSens devices journal part🟨 1
/api/lth/source/connect/Request extra link sessions from the LTH🟨 1
/api/lwg/source/connect/Request extra link sessions from the LWG🟨 1
/api/modbus/req/Send Modbus request🟨 1
/api/modbus/class-find/search-meta-info/Get meta info from search template🟨 1
/api/modbus/class-find/start/Start template Modbus device search🟨 1
/api/modbus/class-find/stop/Stop/cancel template Modbus device search🟨 1
/api/modbus/find/start/Start Modbus device search on RS-485🟨 1
/api/modbus/find/stop/Stop/cancel Modbus device search on RS-485🟨 1
/api/settings/saved/set/Change configuration parameters🟨 1
/api/authorization/code/set/Set temporary authorization code🟥 2