Help‎ > ‎FAQ‎ > ‎

What does the REST request result look like?

posted Feb 16, 2015, 5:05 PM by Tom Gutwin   [ updated Feb 23, 2018, 11:27 PM ]
Example Rest style URL:  http://your.powereye.servername/powereye/rest/power/current

XML response: 
<RestResponse succeeded="true">
    <power unit="watts" timetamp="current">4061.0</power>
</RestResponse>


You can request "your" data using any of
the following http request URLs that have been implemented:

      http://localhost:8080/powereye/rest/price/current
      http://localhost:8080/powereye/rest/price/recent
      http://localhost:8080/powereye/rest/price/<timestamp>
      http://localhost:8080/powereye/rest/power/current
      http://localhost:8080/powereye/rest/power/recent
      http://localhost:8080/powereye/rest/power/<timestamp>
      http://localhost:8080/powereye/rest/energy/current
      http://localhost:8080/powereye/rest/energy/recent
      http://localhost:8080/powereye/rest/energy/<timestamp>

The 'recent' query return the last 10000 values in the same XML format as shown above.
Thats about a days worth of readings.

As of v 1.0, full database table contents can be dumped out in CSV, JSON or XML via REST service calls:

           http://localhost:8080/powereye/rest/db/table/<tablename>
                 --> where  <tablename> can be reading,   energy,   load_device,   load_type

      or with the optional <number of rows>
      and optional <format>
           http://localhost:8080/powereye/rest/db/table/<tablename>/<numRows>/<format>

           <numRows>
             0 dumps ALL
             positive number means sorted descending (newest 1st)
             negative number means sorted ascending (oldest 1st)
            
          <format> can be one of csv , xml, json   [ blank/default=csv ]

      example:
         http://localhost:8080/powereye/rest/db/table/reading/100/json

       returns:
<RestResponse succeeded="true">
<db table="reading" format="csv">

ID|METER_TIMESTAMP|LOCAL_TIMESTAMP|READING|MULTIPLIER|DIVISOR|LEFTNUM|RIGHTNUM|SUPPRESSLEADINGZERO|CALCULATED_VALUE 45977|2223cee8|23-Feb-2018 23:21:12|1591|1|1000|6|3|true|1591.0 45976|2223cee0|23-Feb-2018 23:21:04|1601|1|1000|6|3|true|1601.0 45975|2223cedb|23-Feb-2018 23:20:59|1612|1|1000|6|3|true|1612.0 45974|2223ced5|23-Feb-2018 23:20:53|1603|1|1000|6|3|true|1603.0 45973|2223cec0|23-Feb-2018 23:20:32|1584|1|1000|6|3|true|1584.0
</db>
</RestResponse>

      These database calls can be LOOOOooong so you might want to use a commandline URL query tool like
      wget, or perl or java or whatever.
Comments