diff --git a/docs/Web-API.md b/docs/Web-API.md index b89b2f8..cd64078 100644 --- a/docs/Web-API.md +++ b/docs/Web-API.md @@ -5,33 +5,33 @@ Information in JSON format can be obtained through the web API ## List of URLs may be incomplete -| GET/POST | URL | -| -- | -- | -| Get | /api/config/get | -| Post | /api/config/delete | -| Post | /api/config/upload | -| Get | /api/devinfo/status | -| Get+Post | /api/dtu/config | -| Get | /api/eventlog/status?inv=inverter-serialnumber | -| Post | /api/firmware/update | -| Get | /api/inverter/list | -| Post | /api/inverter/add | -| Post | /api/inverter/del | -| Post | /api/inverter/edit | -| Post | /api/limit/config | -| Get | /api/limit/status | -| Get | /api/livedata/status | -| Get+Post | /api/mqtt/config | -| Get | /api/mqtt/status | -| Get+Post | /api/network/config | -| Get | /api/network/status | -| Get+Post | /api/ntp/config | -| Get | /api/ntp/status | -| Get+Post | /api/ntp/time | -| Get | /api/power/status | -| Post | /api/power/config | -| Get+Post | /api/security/password | -| Get | /api/system/status | +| GET/POST | Auth required | URL | +| -------- | --- | -- | +| Get | yes | /api/config/get | +| Post | yes | /api/config/delete | +| Post | yes | /api/config/upload | +| Get | no | /api/devinfo/status | +| Get+Post | yes | /api/dtu/config | +| Get | no | /api/eventlog/status?inv=inverter-serialnumber | +| Post | yes | /api/firmware/update | +| Get | yes | /api/inverter/list | +| Post | yes | /api/inverter/add | +| Post | yes | /api/inverter/del | +| Post | yes | /api/inverter/edit | +| Post | yes | /api/limit/config | +| Get | no | /api/limit/status | +| Get | no | /api/livedata/status | +| Get+Post | yes | /api/mqtt/config | +| Get | no | /api/mqtt/status | +| Get+Post | yes | /api/network/config | +| Get | no | /api/network/status | +| Get+Post | yes | /api/ntp/config | +| Get | no | /api/ntp/status | +| Get+Post | yes | /api/ntp/time | +| Get | no | /api/power/status | +| Post | yes | /api/power/config | +| Get+Post | yes | /api/security/password | +| Get | no | /api/system/status | ## Examples of Use @@ -52,6 +52,8 @@ may be incomplete You can "talk" to the OpenDTU with a command line tool like `curl`. The output is in plain JSON, without carriage return/linefeed and is therefore not very human readable. +#### Get current livedata + ``` ~$ curl http://192.168.10.10/api/livedata/status {"inverters":[{"serial":"11418186xxxx","name":"HM600","data_age":4,"reachable":true,"producing":true,"limit_relative":100,"limit_absolute":600,"0":{"Power":{"v":70.69999695,"u":"W","d":1},"Voltage":{"v":233,"u":"V","d":1},"Current":{"v":0.300000012,"u":"A","d":2},"Power DC":{"v":74,"u":"W","d":2},"YieldDay":{"v":23,"u":"Wh","d":2},"YieldTotal":{"v":150.5050049,"u":"kWh","d":2},"Frequency":{"v":50.02000046,"u":"Hz","d":2},"Temperature":{"v":8.300000191,"u":"°C","d":1},"PowerFactor":{"v":1,"u":"","d":3},"ReactivePower":{"v":0.100000001,"u":"var","d":1},"Efficiency":{"v":95.54053497,"u":"%","d":2}},"1":{"Power":{"v":0,"u":"W","d":1},"Voltage":{"v":1,"u":"V","d":1},"Current":{"v":0.02,"u":"A","d":2},"YieldDay":{"v":0,"u":"Wh","d":0},"YieldTotal":{"v":49.0320015,"u":"kWh","d":3},"Irradiation":{"v":0,"u":"%","d":2}},"2":{"Power":{"v":74,"u":"W","d":1},"Voltage":{"v":42.40000153,"u":"V","d":1},"Current":{"v":1.74000001,"u":"A","d":2},"YieldDay":{"v":23,"u":"Wh","d":0},"YieldTotal":{"v":101.4729996,"u":"kWh","d":3},"Irradiation":{"v":18.04878044,"u":"%","d":2}},"events":3},{"serial":"11418180xxxx","name":"HM800","data_age":11,"reachable":true,"producing":true,"limit_relative":100,"limit_absolute":800,"0":{"Power":{"v":70.09999847,"u":"W","d":1},"Voltage":{"v":233.1000061,"u":"V","d":1},"Current":{"v":0.300000012,"u":"A","d":2},"Power DC":{"v":73.59999847,"u":"W","d":2},"YieldDay":{"v":48,"u":"Wh","d":2},"YieldTotal":{"v":48.5399971,"u":"kWh","d":2},"Frequency":{"v":50.02000046,"u":"Hz","d":2},"Temperature":{"v":11.39999962,"u":"°C","d":1},"PowerFactor":{"v":1,"u":"","d":3},"ReactivePower":{"v":0.100000001,"u":"var","d":1},"Efficiency":{"v":95.24456024,"u":"%","d":2}},"1":{"Power":{"v":36.5,"u":"W","d":1},"Voltage":{"v":39.09999847,"u":"V","d":1},"Current":{"v":0.930000007,"u":"A","d":2},"YieldDay":{"v":31,"u":"Wh","d":0},"YieldTotal":{"v":4.301000118,"u":"kWh","d":3},"Irradiation":{"v":8.902439117,"u":"%","d":2}},"2":{"Power":{"v":37.09999847,"u":"W","d":1},"Voltage":{"v":40.79999924,"u":"V","d":1},"Current":{"v":0.910000026,"u":"A","d":2},"YieldDay":{"v":17,"u":"Wh","d":0},"YieldTotal":{"v":44.23899841,"u":"kWh","d":3},"Irradiation":{"v":9.048780441,"u":"%","d":2}},"events":1}],"total":{"Power":{"v":140.7999878,"u":"W","d":1},"YieldDay":{"v":71,"u":"Wh","d":0},"YieldTotal":{"v":199.0449982,"u":"kWh","d":2}}} @@ -384,7 +386,7 @@ martin@bln9716cm ~/swbuild/OpenDTU $ curl --no-progress-meter http://192.168.10. } ``` -### combine curl and jq +#### combine curl and jq `jq` can filter specific fields from json output. @@ -394,6 +396,15 @@ For example, filter out the current total power: 140.7999878 ``` +#### Get information where login is required + +When config data is requested, username and password have to be provided to `curl` +Username is always `admin`, the default password is `openDTU42`. The password is used for both the admin login and the Admin-mode Access Point. + +``` +~$ curl --u admin:openDTU42 http://192.168.10.10/api/ntp/config +{"ntp_server":"pool.ntp.org","ntp_timezone":"CET-1CEST,M3.5.0,M10.5.0/3","ntp_timezone_descr":"Europe/Berlin"} +``` ### Post information