Have a look at the Open API documentation here:
https://www.foxesscloud.com/public/i18n ... 03e203ca3e
The real time data query is a post so does not have URL parameters. You need to post a body with the serial number and the variables you are querying for. Here is a working example of the API call setup and response:
Code: Select all
getting real-time data
body = {"deviceSN": "65BH60..."}
path = /op/v0/device/real/query
headers = {'Token': '72a2a...', 'Lang': 'en', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36', 'Timezone': 'Europe/London', 'Timestamp': '1735735442541', 'Content-Type': 'application/json', 'Signature': '7c65d33f89811065c081afa5ff0518cd'}
[{'unit': 'kW', 'name': 'PVPower', 'variable': 'pvPower', 'value': 0.06},
{'unit': 'V', 'name': 'PV1Volt', 'variable': 'pv1Volt', 'value': 187.6},
{'unit': 'A', 'name': 'PV1Current', 'variable': 'pv1Current', 'value': 0.2},
{'unit': 'kW', 'name': 'PV1Power', 'variable': 'pv1Power', 'value': 0.038},
{'unit': 'V', 'name': 'PV2Volt', 'variable': 'pv2Volt', 'value': 221.1},
The problem with using a web service for MD5 may be that the timestamp is too far out of the current time. The API will only accept requests where the timestamp and signature have been generated dynamically within the last few seconds to avoid replay attacks.