Get device status
1 min
code examples curl request get \\ \ url /api/status \\ \ header 'accept application/json'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var requestoptions = { method 'get', headers myheaders, redirect 'follow' }; fetch("/api/status", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("/api/status") http = net http new(url host, url port); request = net http get new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" response = http request(request) puts response read body import requests import json url = "/api/status" payload = {} headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("get", url, headers=headers, data=payload) print(response text) responses // information retrieved successfully { "device" { "serial number" "203638485431500400123456", "usb mac" "0c\ fa 22 21 2a 31", "wifi mac" "0c\ fa 22 21 2a 31", "ble mac" "0c\ fa 22 21 2a 31", "otp valid" true, "otp model" "bb 1", "otp timestamp" 1767225600 }, "firmware" { "version" "1 0 0", "target" 22, "branch" "main", "build date" "2024 01 01", "commit hash" "abc123def456 dirty", "nwp version" "1711 2 14 5 2 0 7", "matter version" "1 0" }, "system" { "api semver" "0 0 0", "uptime" "00d 00h 04m 13s", "boot time" 1767225600, "auto update enabled" true }, "power" { "state" "discharging", "battery charge" 99, "battery voltage" 4183, "battery current" 180, "usb voltage" 4843 } }// internal server error { "error" "", "code" 0 }
